From the JargonFile:

worm, n.
[from tapeworm in John Brunner's novel The Shockwave Rider, via XEROX PARC] A program that propagates itself over a network, reproducing itself as it goes. Compare Virus. Nowadays the term has negative connotations, as it is assumed that only crackers write worms. Perhaps the best-known example was Robert T. Morris's Great Worm of 1988, a ‘benign’ one that got out of control and hogged hundreds of Suns and VAXen across the U.S.
See also cracker, RTM, Trojan horse, ice.

MyDoom and many other Email-borne malware are Viruses, but some of them also reproduce themselves by other means, so the line can be hard to draw.