The worms found in swimming pools are called horsehair or Gordian worms. They grow up to 14 inches long and look like long strands of horsehair. Their appearance and their constant movement as they slowly twist themselves into knots is the origin of both their names.
While finding horsehair worms in a pool is unsettling, they pose no danger to humans. They are parasites that attach themselves only to insects. The worms appear in pools or bodies of water because they need water during reproduction to lay their eggs. After a couple of weeks, the eggs hatch and the young crawl into vegetation where insects accidentally consume them while feeding. The young worms need to be inside insects to fully mature. Once this happens, the host insects seek out water. The working theory is that upon maturity of the worm, the host insect experiences an urge for water. Once the insect is in the water, the horsehair worm emerges where it then waits to reproduce. During mating, the male and female twist themselves into balls.
Even if the host insect containing the worm is devoured by a predator, the worm almost always survives. It wiggles out of the predator and seeks out water.