How the immune system works
To understand how and why vaccine reactions occur, it is first necessary to understand how the immune systemImmune systemA complex system of organs and processes in the body responsible for fighting disease. Its primary function is to identify foreign substances in the body (including bacteria, viruses, fungi, parasites or transplanted organs and tissues) and develop a defense against them. This defense is known as the immune response. helps to protect the body against infection. It is designed to identify and destroy harmful foreign organisms (pathogens
PathogenAny disease-causing substance. Most commonly used for organisms (e.g., bacteria, viruses) and their biological products (e.g. toxins).) from the body, and neutralize the toxins (poisons) that some bacteria produce.

Source: wikipedia.org
The pathogens causing the vaccine-preventable diseasesVaccine-preventable diseasesDiseases for which vaccines exist that can confer partial or complete protection. described in this module are mainly microorganisms
MicroorganismsTiny organisms (including bacteria and viruses) that can only be seen with a microscope. such as bacteria
BacteriaSingle-celled life-forms that can reproduce quickly on their own. Some bacteria cause disease. or viruses
VirusAn ultramicroscopic infectious agent that consists of genetic material surrounded by a protein coat. A virus can replicate themselves only within cells of living hosts..
- Bacteria are single-celled life-forms that can reproduce quickly on their own.
- Viruses, on the other hand, cannot reproduce on their own. They are ultramicroscopic infectious agents that replicate themselves only within cells of living hosts.

Source: wikipedia.org
The immune system responds to bacteria and viruses in a very complex way: it recognizes unique molecules (antigensAntigenA foreign substance in the body that triggers the production of antibodies.) from bacteria and viruses and produces antibodies (a type of protein) and special white blood cells called lymphocytes that mark the antigens for destruction.
During the primary immune responseImmune responseThe body's defense against foreign objects or organisms, such as bacteria, viruses or transplanted organs or tissue. to the first encounter with a specific pathogen, some lymphocytes called memory cells develop with the ability to confer long-lasting immunity
ImmunityThe body's response mechanism for fighting against bacteria, viruses and other foreign substances. If a cell or tissue (such as bacteria or a transplanted organ) is recognized as not belonging to the body, the immune system will act against the "invader." The immune system is the body's way to fight external invasions. to that pathogen, often for life. These memory cells recognise antigens on the pathogens they have encountered before, triggering the immune system to respond faster and more effectively than on the first exposure.

Source 1: wikipedia.org, Source 2: wikipedia.org
The graph below compares the primary and secondary immune responses to the same pathogen. The secondary response may eliminate the pathogens before any damage occurs.59

Key point
Immunization triggers an immune system response by which the vaccinee develops long-term protection (immunity) that would normally follow recovery from many naturally occurring infections.