There are several ways a computer can get infected by a virus, and most of them involve downloading – either intentionally or unintentionally – infected files. Pirated music or movies, photos, free games, and toolbars are common culprits, as are phishing/spammy emails with attachments. Viruses can also be downloaded by visiting malicious websites or clicking links or ads to an unknown/unsecured website. Even connecting to an infected external drive (like a USB) can introduce malicious software into your system.