Hagfish are marine craniates of the class Myxini, also known as Hyperotreti. Despite their name, there is some debate about whether they are strictly fish (as there is for lampreys), since they belong to a much more primitive lineage than any other group that is commonly defined fish (Chondrichthyes and Osteichthyes). Their unusual feeding habits and slime-producing capabilities have led members of the scientific and popular media to dub the hagfish as the most “disgusting” of all sea creatures.
Hagfish are long, vermiform and can exude copious quantities of a sticky slime or mucus (from which the typical species Myxine glutinosa was named). When captured and held by the tail, they escape by secreting the fibrous slime, which turns into a thick and sticky gel when combined with water, and then cleaning off by tying themselves in an overhand knot which works its way from the head to the tail of the animal, scraping off the slime as it goes. Some authorities conjecture that this singular behavior may assist them in extricating themselves from the jaws of predatory fish. However, the “sliming” also seems to act as a distraction to predators, and free-swimming hagfish are seen to “slime” when agitated and will later clear the mucus off by way of the same travelling-knot behavior.
Information retrieved from: http://divaboo.info