Malware is malicious code that can be added to your computer by actors that have bad intentions. A virus is a specific type of malware that directly targets your computer's software. There are several other types of malware, but viruses are the most common.
It is said that humans are the weakest link when it concerns security protections. People unintentionally add malware to their computer when downloading an attachment sent to them over email (a so called phishing email), or they click on a link that directly leads to a website containing malware.
Here are some general guidelines: