The light emitted by certain bioluminescent organism comes from energy generated from chemical reactions existing inside (or driven out by) the organism.
As you’ve ever spotted a firefly, you have also encountered a bioluminescent organism. In the ocean, this bioluminescence is not nearly as unusual as you could possibly think. As a matter of fact, almost all kinds of animals, from bacteria to sharks, consist of some bioluminescent members.
Even as the abilities of bioluminescence are not widely known for all animals, basically bioluminescence is used as a tool to warn or evade predators), to attract or detect prey, and also for communication between the members of similar species.