This is an incredibly complex question which I will provide many links for you to take a look at so you can understand the process in greater detail.
"Viral or Bacterial Infection
When a virus or bacteria (also known generically as a germ) invades your body and reproduces, it normally causes problems. Generally the germ's presence produces some side effect that makes you sick. For example, the strep throat bacteria (Streptococcus) releases a toxin that causes inflammation in your throat. The polio virus releases toxins that destroy nerve cells (often leading to paralysis). Some bacteria are benign or beneficial (for example, we all have millions of bacteria in our intestines and they help digest food), but many are harmful once they get into the body or the bloodstream.
Viral and bacterial infections are by far the most common causes of illness for most people. They cause things like colds, influenza, measles, mumps, malaria, AIDS and so on.
The job of your immune system is to protect your body from these infections. The immune system protects you in three different ways:
The immune system also has several other important jobs. For example, your immune system can detect cancer in early stages and eliminate it in many cases.
A virus is a different breed altogether. A virus is not really alive. A virus particle is nothing but a fragment of DNA in a protective coat. The virus comes in contact with a cell, attaches itself to the cell wall and injects its DNA (and perhaps a few enzymes) into the cell. The DNA uses the machinery inside the living cell to reproduce new virus particles. Eventually the hijacked cell dies and bursts, freeing the new virus particles; or the viral particles may bud off of the cell so it remains alive. In either case, the cell is a factory for the virus." http://www.howstuffworks.com/immune-system3.htm
The following links will provide you with a very good basic understanding on immunity and disease:
Please click "Accept" if you found this to be helpful and informative!