The firefly is a coleopteran insect that has light emissions due to phosphorescent organs located in the lower abdomen. These light emissions are called bioluminescence and occur due to chemical reactions where the luciferin is oxidized by nuclear oxygen producing oxyluciferin which loses energy causing the insect emit light.
Another factor that drives luminous emissions is to call your partner or partner's attention. The male emits his light warning that he is approaching while the female perched in a certain place, emits her light to let her know where she is.
In the chemical reaction, approximately 95% of the energy produced is transformed into light and only approximately 5% is transformed into heat. The light-emitting tissue is attached in the trachea and brain, giving the insect full control over its light.
Unfortunately, fireflies are threatened by strong lighting in cities, because when they come into contact with this strong lighting, its bioluminescence is canceled, strongly interfering with reproduction, and may even be extinct.
Source: Brazil School - https://brasilescola.uol.com.br/curiosidades/a-luz-vagalume.htm