The light that glow worms create is known as bioluminescence, a light created by chemical reactions that take place inside an organism's body. This is sometimes called "cold light," because the luminescence produces hardly any heat; the worms do not have the resources to produce an energetic reaction and must conserve all the resources they can. Their bodies create enzymes that naturally react with other excretions to produce the effect in an area of the worm's body where it can be seen.
Most glow worms are actually larva that will eventually develop into flies from the family Lampyridae. While fireflies use their similar bioluminescence abilities to communicate and attract mates, some worms also use cold light to attract prey, although this differs from species to species. During their worm form, the insects attach themselves to trees, ground cover and rocks in moist places. When female glow worms want to attract a mate, they crawl to the edges of grass blades and signal up into the air. The males, which can fly, spot the light with their large eyes and fly down to mate. Worms that use bioluminescence to catch prey suspend themselves from heights and weave snares out of their silk that they lower down into the air. Small bugs attracted by the pale light that the worms produce fly into the snares, and the worms draw them in.
These cold light reactions take place in the worms' abdomen region, where the skin is translucent enough to allow the luminescence to shine through. Here many tubes known as malpighian tubules process the nutrients and waste that the worms absorb, as well as the air they breathe. Here the worms produce a special enzyme called luciferase, in addition to ATP (the molecule from which life forms draw energy to power their muscles and biological reactions). Both luciferase and ATP combine with a protein waste product that the worm naturally excretes known as luciferin.
These three chemicals combine in the worm, but require a catalyst to produce light. This catalyst is provided by oxygen from the air the worm breathes. This oxygen oxidizes the chemical combination, and produces the bioluminescence. Worms can control the reaction by pumping in more or less oxygen or by cutting off the supply altogether.