Computers worms are designed to leverage vulnerabilities that allow them to gain control over a device then scan the network for other vulnerable devices and so one
Trojan horses usually use social engineering, like a pirated software or a fake Office document send by mail, to gain control over a computer. Once installed, they usually hide themselves from the system and make it impossible for the user to remove.
Computer viruses were the first kind of malware that were developed. At the beginning, they were not malicious per se (the first computer virus “Creeper”, developed in 1970 only displayed a message), but soon after malicious ones begin to appear and counter-measures known as “anti-virus” software were developed.