Jellyfish that glow do so in order to attract prey and as a form of defense against predators. Jellyfish are able to do so due to phosphorescence, luminescence or bioluminescence.
Jellyfish, such as sea nettles, use their ability to glow to surprise or frighten away predators. This works because the small size and long tentacles of the jellyfish are magnified by the light, making them appear larger to potential predators. Some jellyfish drop their tentacles as a form of distraction that can confuse predators. Predators are typically attracted by the light of the falling tentacle and focus their attention on it instead of the jellyfish's body, which gives the jellyfish the chance to escape.
Some jellyfish use phosphorescence to absorb energy and slowly release it over time in the form of light. This is what gives them the appearance of glowing. Others, such as the Aequorea victoria, use the luminescent protein aequorin and fluorescent molecules to create bioluminescence that causes them to glow. The small amount of sunlight that reaches the ocean's depths where some jellyfish live allows the water to absorb red, orange and yellow light while simultaneously scattering ultraviolet light, which is absorbed by jellyfish and many other glowing sea creatures.