Answer: Horsehair worm, also known as the Gordian worm, in the group Nematomorpha.
Over 300 species in this group have been described. They are parasitic in their larval stage for various insects and crustaceans, and emerge from the host (as seen in this case) as free-living adults. The adults are typically found near or in water and are known to twist themselves into complex knots (resembling Gordian knots).
These worms superficially resemble nematodes and they are not uncommonly submitted to our lab for identification; however, they are not parasites of humans or other mammals.