The difference is mostly a matter of historical tradition.
Biologically, a virus is a piece of RNA. RNA is an intermediary vessel for genetic code, which temporarily duplicates a piece of the DNA (the permanent storage of genetic information in a cell). RNA then goes through some "engines" which can duplicate it and/or convert it into proteins (genetic code is really blueprints for proteins). Proteins are the active molecules which do all the work to keep a cell "alive". The virus is sufficiently small to enter some cells, where it hijacks the replicator engine, which makes other copies of the virus, by which the attack spreads. The adverse effect of the virus comes from the fact that while the replicator is busy with photocopying the virus, it does not process the "normal" RNA which comes from the cell's own genetic code. Protein production is thus slowed down or stopped altogether, and the cell ceases to function properly (or at all). Effects on the host body depend on what kind of cells are affected, and how much it hijacks the replicators. So the virus is not a living organism by itself (the question of whether a virus can be considered to be "alive" is hotly debated, and not very meaningful in the same time).
On the other hand, a worm is a fully-defined pluricellular organism, which does not interact in any way with the host genetic code and mechanism; the worm just sits there and feeds on local cells. The worm is quite definitely alive and distinct from the host, which, from the worm point of view, is mostly home and feeding ground. The worm also replicates itself, but since this is a living organism, such replication is called "reproduction".
In computers, some software pieces are called "virus" and "worm" as an analogy which, like all analogies, breaks down when you looked at it too closely. The "replicator engine" alluded to above, is considered as somehow equivalent to normal program execution. Under normal operational conditions, computers execute programs by reading executable files into memory, and ordering the CPU to consider that data as a sequence of instructions which are to be interpreted right away. A computer virus is a piece of code which hijacks normal execution by inserting its own code somewhere in that sequence of instructions. The analogy stops there, because while a biological virus just uses an RNA replication mechanism which is already in place and totally genuine, the computer virus must do its own replication, i.e. looking for other executable files to copy its own code in them. A virus may be harmful through this replication mechanism, depending on whether its forceful insertion in executable files damages them or not (a careful virus will move around the original instructions so that they still get executed; a careless virus replaces the original instructions, thus affecting the executable primary functionality). A virus may also be harmful by doing other tasks than mere replication (that's the "payload" and it can be quite nasty).
A computer worm is a piece of software which, when executed, tries to replicate itself through the network. The worm uses a few known security holes to force remote machines to execute some arbitrary code, and in the case of a worm, that arbitrary code is the worm code itself. So we have the traditional distinction: a virus replicates itself by modifying executable files (found, by essence, "locally") while a worm replicates itself through network-exploitable security holes. However, a worm which runs on a given machine will often, beyond its replication-through-network job, take steps to become "permanent", so that it will run again regularly, even if the host machine is rebooted. Permanency is achieved by inserting the worm code into some executable files; so, most worms are also virus.
This leads us to a second definition: a worm is a virus which can also replicate itself through a network, using remotely exploitable security holes, whereas a plain virus is limited to executable files.
Virus and worms where thus named because when such things began to be common place (around 1985-1990, when home computers became widespread and used floppy disks, and Internet exceeded a few hundred hosts), program execution on a basic computer was not happening "by itself": the user had to type something or click on something to launch a new executable. So the spread of a virus could be paused by getting your hands off the keyboard, whereas a worm had the seemingly magical property of happening by itself. Nowadays, the most basic PC will spawn hundreds of new processes transparently, many of them on an automatic and regular basis, so a virus will also replicate in a seemingly autonomous way, blurring the operational distinction between virus and worm.
The Trojan Horse is a big hollow wooden horse filled with ill-intentioned Greek warriors, and happens not to be Trojan at all -- it was Achaean, built against the Trojans. The cornerstone of the story (as reported in the Odyssey) is that the Trojans pulled the horse within the walls of Troy themselves, a military feat which the Achaeans had unsuccessfully tried to achieve for the ten preceding years. In computers, the expression "Trojan Horse" was applied to the case of a malicious executable which a target user launches himself consciously, lured by some advertised seemingly benign functionality of the executable. Trojans believed that the horse was an offering to the gods of the sea, hence imbued with religious and esthetic goodies.
So, what of a piece of software which, when executed, finds local executable files to copy itself, and also sends itself by email to random other people under a cunning guise ("this is your tax form, fill it ASAP or you will get fined"; or "have a peek at this screensaver full of photos of Natalie Portman"), to lure them into clicking on the attached executable file, thereby executing its contents ?
This is a virus, since it copies itself into local executable files. This is a worm, since it replicates itself through the network (the remotely exploitable hole being the combination of the user, who has little awareness of security issues, and his mail reader application, which happily runs executable files with only the flimsiest of guardrails). This is a Trojan Horse since it exploits user gullibility and lures him into launching malicious code.
Hence, the distinction between virus, worm and Trojan Horse is not absolute and has become quite fuzzy in recent years. The terminology does not offer practical information anymore.