A virus is...
Viruses are complex pieces of malicious code intended to do harm to other computer. What is malicious code you ask? Well, to explain malicious code first I have to explain binary code.
Binary code is complex patterns of 1s and 0s which tell the computer to do this or do that. Example: SHIFT + a key is pressed activate code 101011 project letter A onto the screen. Or something like that. Binary code turns into malicious code when it is used to create any virus or any variations of a virus, those variations being a Worm or a Trojan.
Worms are like viruses in these ways, they are made of malicious code, they are malicious and they travel the internet. One worm, the slammer worm, knocked out almost the entire internet in one night! Worms are different because they do not need human aid to spread themselves or infect computers but overall you could say that the worm is the upgraded version of the virus and, you know thats probably right.
Trojan horses are different they spread and infect with human aid but they are capable of doing worse things than worms because their not obvious to the owner until he sees something is changing.
On thee overall all you can really say is, viruses were made to do harm (or make people incredibly annoyed).
A short history of viruses
The first virus ever was created in 1981 and was called elk cloner and it wasn't really destructive, just a prank. all it did was displayed a rhyme on the screen which went like this.
It will get on all your disks
It will infiltrate your chips
yes its cloner!
It will stick to you like glue
It will modify ram too
send in the cloner!
I find the rhyme rather funny but lets go back to the subject. The first documented virus was actually created to prove that such could be done, it didn't have any name in particular but was made in 1983. After this virus than the public started making viruses. in 1987 the first file viruses started to appear and also the Lehigh virus and the Christmas worm. following in the footsteps of those viruses in 1988 was the first virus for Macintosh computers, it was called macmag or scores. In 1988 there was also the first internet crises. in 1991 the first polymorphic virus came into existence and was sent from Switzerland and I don't know its name. After being sent the virus changed its form to disguise itself.
1995 was the year when hackers attacked the Griffith air force base, the Korean atomic research institute, NASA and assorted other companies and places. In 1996 the first virus specified for certain files (in this case it was windows 95 files) was created and in 1998 the first java virus was created and named strange brew. In between 1999 and the year 2000 the first palm pilot virus appeared and also the first combination virus was created. In 2002 the first virus to attack shockwave files was created and then in 2004 a record was set for the most viruses created in 1 year.
Worms
Contrary to most ideas, worms are NOT viruses, although worms ARE made of malicious code they are not viruses. A worm just enters the computer infects it and then that computer starts spewing out millions of clones of the worm instantly which randomly target other other computers, infect them and then well, you know. The most destructive worm was called slammer, here is its story.
Slammed
On January 25th 2003 at exactly 12:30 PM from his internet security monitor Owen Maresh suddenly saw fifty-five million meaningless server request traversing the globe "I never saw anything like it" he says. Owen was the first person in the world to see the worm which would later come to be know as slammer and after 3 minutes at 12:33 EST The number of slave servers in slammer's army was doubling every 8.5 seconds. By 12:45 large sections of the internet began to disappear and 5 out of 13 of the root servers for the internet were out, a Linux specialist in Manhattan spammed his colleagues in uppercase (Capital letters) to make it clear he was screaming "MS SQL WORM IS DESTROYING INTERNET BLOCK PORTAL 1434" but it was to late. By then slammer had knocked out more than the internet cell phones wouldn't work the cost of the disaster overflowed into the next week. No one knows who did it but in the future every black hat will have 15 minutes of fame.
Don't go away there's still more!