An illness can be caused by pathogens -- bacteria and viruses that cause disease. These foreign invaders can enter the body in different ways, such as through an open wound, by inhalation, or through contact with mucus membranes of the eyes, nose, or mouth.
If your body becomes infected by a pathogen, the white blood cells circulating in the blood go through a trial-and-error period to determine the best way to kill the organisms. During this period, the body is sick with symptoms of the illness. When the white blood cells determine how to destroy it, they create "memory cells" to handle future attacks of that same pathogen.
Vaccination is a way to trigger the body’s immune response without becoming sick. The vaccine contains weak or dead organisms that usually do not cause illness. The body is able to destroy the pathogen in the vaccine and produce memory cells. When the body develops immunity to a specific pathogen, immunization has occurred. If the body is ever exposed to the same pathogen in the future, the memory cells react quickly without a trial-and-error period. This allows the body to destroy the pathogen efficiently before it can cause illness.