The role of Gamma Proteobacteria in producing light is discussed in detail in reference works. The capacity to produce light is an extension of normal metabolism: all chemical reactions produce a few photons. Visible light is produced when the photon production increases. In the case of bacteria, the original function of the reaction was probably to detoxify excessive oxygen.