The first computer virus, written in 1971 by anti-virus pioneer Dr. Fred Cohen, was a benign program intended to prove his nascent theories on the nature of computer viruses. The "program," known as the "Creeper," would display a short message on every infected machine:
"I'm the creeper, catch me if you can!"
The virus spread rapidly from one machine to another but never did any damage. Despite the lack of dangerous payloads, Cohen received a Ph.D. for his work on "computer viruses," and went on to teach at UC Santa Barbara, where he is now professor emeritus. Dr. Cohen continues to research in the field of computer security and is a frequent conference speaker.
The Creeper was not intended to harm or damage computers; its goal was to prove that viruses could exist on computers and spread without user interaction. At the time there were few known examples where data could make its way from one machine to another (one example was "data chaining," wherein two programs would create data which when run by itself produced output).
Many conspiracy theories are surrounding the origin of the Creeper virus--most notably among them: that the Creeper may have been originally written by somebody else, but that Dr. Cohen either modified or outright stole their code and claimed credit for creating it himself. This seems unlikely, however: while Cohen may have been a computer whiz kid, there is no evidence to suggest that he had the chops to write an entire virus from scratch in assembly language, let alone at age 20.
The Rabbit Virus
The first virus to appear after the Creeper was known as "the rabbit virus." First detected in late 1971, its exact origin is unknown. The legend of the Rabbit Virus spread quickly among computer science circles, but it had almost no impact at all on anti-virus research until years later when Dr. Leonard Adleman came across mentions of it while studying for his Ph.D. at MIT under famed cryptographer Ron Rivest (co-founder of RSA Data Security).
Adleman spent years trying to track down an actual copy of the virus; in 1982 he came across a reference from a Usenet post which mentioned that there were two original copies of the virus--one at Purdue University, and one which had been loaned out. He eventually succeeded in his quest and has since published papers on the nature of the rabbit virus.
The First Trojan Horse
There's some controversy over which program was the first "true" Trojan horse (that is, a program designed to appear useful while performing some malicious task). But if we're talking about the first known virus of this kind, it would probably be Creeper. A few months after Creeper appeared at least one group of computer-savvy pranksters decided to take advantage of its existence and created an infected version of the game Hunt The Wumpus. This version of the game contained the same text strings as the original versions, but when played it took control of the user's terminal so that he/she could not exit until they entered a specific code. The code was widely available in most circles, so by spreading it the pranksters were able to send many unwitting users on wild goose chases.
The first known "worm" (a self-replicating program that spreads over computer networks) was created in the late 1970s by graduate students at Duke University, who were attempting to develop a benign version of Creeper which would improve local area networks performance. With their creation, they made an interesting discovery: that people not only welcome worms into their computers, but actively seek them out--even if they are completely unaware that it is happening. This insight formed the basis for what has become known as "viral marketing."
While many different forms of viral marketing have come and gone since this discovery, one very successful example is the kind used by Hotmail.
The LoveLetter Virus
The first known virus to erase files was created in 1987 by a 19-year old named "Hon Jen Yee" (a pseudonym he adopted shortly before the release of his virus). He called it "the LoveLetter virus," and it came to be after he became frustrated with his inability to make friends at Rensselaer Polytechnic Institute. His code was not designed specifically for this purpose, but because it spread so quickly Jen Yee quickly realized that it could be used as an effective prank--so long as nobody knew who had sent it.
He designed a special version of the virus which contained a provocative message written in German and sent it to several school officials. After it infected their systems they were then instructed to send copies of themselves to RPI students he had selected as possible targets.
He also included his name and phone number in the body of the message, but removed them from the "TO:" line so that nobody could call him.
The LoveLetter virus caused an international crisis when it briefly shut down the mail servers at Microsoft and several other large companies by simply replicating itself to all addresses on hard drives connected to those servers. It also made Jen Yee a millionaire when he sold the code to a company that used it as part of a direct marketing campaign for one of their products.
The Code Red Virus
The Code Red Virus was created in 2001 by two students at Cal State University (one in computer science, the other in journalism). Their motivation was simple--to test whether or not they could trick people into running a virus with no payload. The code itself is short and quite simple; it only contains 10 lines of code.
The two initially attempted to spread their creation through e-mail but found that most people simply deleted it before reading it. So they decided to send the virus out under the guise of an anti-virus company called Innovative Marketing, Inc., which had recently conducted an advertising campaign for one of its products that had gone awry. They also included a phony message claiming that Microsoft had recommended using their product to protect against the virus.