It’s a chemical reaction called bioluminescence. Basically what happens is cells in a fireflies tail produce something called Luciferin Enzyme, This enzyme makes a chemical reaction that generates light.
If we were to recreate the chemical process of the firefly, we could make a bioluminescent light bulb. This would save on fossil fuels and be better for the environment. To save on energy people could start breeding fireflies, and keep them in jars around the house.