From iA wiki
A worm may be a collection of different programs viruses and other malicious code that tries to scan the net for automatic spreading. Worms are often performing more complex actions that virus can, e.g. coordinating DDOS attacks, finding other vulnerable hosts or collecting interesting data.
The major difference between a virus and a worm has a biology parallel. Viruses infect other normal cells in order to survive. Worms are separate organisms. In computers, a worm does not infect other programs like a virus does. This means that, if you find your computer is infected with a worm, you do not need to go through and disinfect your storage media looking for more instances of the worm. It does not bother infecting other files in favor of focusing on the big score: the network or an individual victim's computer.
Before the Internet, viruses transmitted themselves by infecting a system and covertly altering that computer's executable files. Then, when someone took their floppy home, for instance, the virus would infect that computer and so on. Because computers are now connected over the Internet, it is no longer necessary for a malicious program to infect individual files in order to survive and create havoc. It is much easier to do it over the Internet.
The idea of the concept of worms has been credited to John Brunner, who used the term in his novel The Shockwaverider.