A computer virus is a self-replicating program that can infect computers without the owner's consent, with notable examples including the Creeper virus from the 1970s and the Melissa and I Love You viruses from the late 1990s. Viruses can take various forms, such as trojan horses and worms, and exhibit behaviors like altering files or slowing down system performance. Prevention methods include using antivirus software, being cautious with emails and attachments, and regularly updating protective software.