Malware, or malicious software, is any program or file that is harmful to a computer user. Types of malware can include computer viruses, worms, Trojan horses, and spyware. Malware, developed by cyberattackers, is designed to cause extensive damage to data and systems or to gain unauthorized access to a network. 
 

9 types of malware and how to recognize them | CSO Online

Image courtesy 
csoonline.com

Virus vs Worm vs Trojan

Virus :A computer virus is an application that needs to be downloaded or otherwise transferred onto the host computer before the infection can take place


Worm
:A computer worm is an application that accesses a computer over a network.It doesn’t require the user to download or open any host application.


Trojan
:They do not replicate themselves like virus.  Trojan horse  spread through attachment