There are two aspects to this question: the biological and the digital. Please skip to the one that presently concerns you, or read the aspect you are most comfortable with.
The Biological Aspect
The word 'bug' is often used as a general term meaning 'insect'. Other animals, notably some arachnids (spiders, scorpions) are often included in this category, probably because there are still those around who think that spiders are insects.
Taking the wider definition, bugs generally range in size from a few millimetres to maybe ten centimetres long, although there are some that are so small as to be invisible to the naked eye. However, one important fact remains: a bug, even a small one, is a multicellular animal.
A virus, on the other hand, is not even a whole cell in itself. Instead, it is a piece of genetic code (like DNA) that invades a healthy cell, and tries to insert its code into that of the cell, forcing the host cell to make copies of the virus so that it spreads through the infected organism and beyond. Thus it is possible for a bug to carry a virus, but not vice versa.
Perhaps the problem comes from some people saying 'I think I've caught a bug' when they're sick when they should be saying 'I have been invaded by incredibly small organisms, the smallest organisms that are still considered to be alive, and am now functioning as an incubator for their genetic code.' Perhaps one can hardly blame them.
The Digital Aspect
A bug is a defect in a computer program, often described as a 'feature' by clever marketing people. The term is said to have originated in the days comes when the very first computers, huge and sprawling, filled whole floors of large buildings. It was said that a certain programmer, after slaving for hours trying to find out why his program wasn't working properly, found that a moth had got stuck inside the computer and was shorting one of the components.
Bugs now usually come from oversights in the programming of software, or because not all the possible conditions of the program could be tested completely. This means that by using a piece of software long enough, you might trigger the right combination of inputs, outputs and internal conditions that might not have been anticipated by the programmers, and then the software can start to behave unpredictably.
Viruses came later, and although the first one was created on an Apple Macintosh computer for the purpose of exploring the machine, most viruses today infect MS-Windows based systems.
Digital viruses are similar to biological viruses in that they too are sequences of code that force bigger programs to reproduce them. Typical viruses infect executable files by placing a 'jump' instruction at the beginning of the program, and then adding their own code to the end of the file, so that when the program is run, the virus runs first, which infects memory, letting the virus infect other executable files, before jumping back to the host program itself, as if nothing had happened.
It should be mentioned here that viruses may cause bugs, by making some programs on a computer unstable, but it is extremely improbable (though not impossible) that bugs may cause viruses by themselves. However, bugs often provide loopholes through which viruses can spread.
The best way not to get a virus is to stay isolated, whether the virus is biological or digital in nature. However, complete isolation from society is rarely healthy, and completely isolating your computer from the Web means not visiting h2g2, which could be a bigger loss ultimately than the risk of getting a digital virus.