How does spray tanning work?

The active ingredient is DHA (dihydroxyacetone) and is approved by the FDA for external use. It is the active ingredient in all self-tanners.

Dihydroxyacetone (DHA) is derived from sugar beets or cane sugar and is a key active ingredient for natural self-tanners. The skin-browning effect is the result of a nontoxic chemical reaction between DHA and the amino acids which are part of the keratinous layer of the skin’s surface, much like the browning effect in food caramelization. The resulting color is called melanoidins, similar in color to the melanins our bodies produce naturally when exposed to UV rays.

DHA creates a more naturally-looking tan, and fades more evenly, than chemical tanners and is now considered the most effective sunless tanning ingredient. It is also considered the safest form of tanning over chemically-derived self-tanners and sun exposure. The tan will fade gradually over the course of 3-10 days. (Wiki)

Origin: Dihydroxyacetone (DHA) is obtained by the fermentation of certain sugars, like sugar cane and beet sugars.