The first one was written in 1982 for an Apple II by a 15 year-old Pittsburgh high school student, Rich Skrenta.
Called Elk Cloner it basically sent an annoying poem to users explaining how it could spread itself.
Skrenta managed to hack off most of his friends by sending them crippled versions of pirated games with the Elk Cloner installed. Despite the fact it relied on people to swap infected disks it spread quite well. It also got him into trouble with his maths teacher who was infected by the virus.
He said on his website that Elk Cloner was the stupidest hack he ever coded and yet generated the most interest.
It was not until four years later that the first virus appeared on an IBM PC.
So says the Scientific American, here. µ