Fireflies Light Up to Flirt
As Marc Branham, an entomology professor at the University of Florida explained to Scientific American, the light itself is a result of so-called “cold light.” Oxygen combines with calcium, adenosine triphosphate (ATP), and the chemical luciferin, and light is produced with minimal energy being lost to heat.
Fireflies mainly emit light to attract mates (via certain light patterns) or to defend territory (that’s why when you put them in a jar, they light up, as a defense mechanism).