A vaccine is a way to build to build the body's natural immunity to a disease before the the disease itself actually arrives.
For the majority of vaccines, it's a weaker form of the disease germ that is injected into the body. The body then detects the invading germs and then proceed to create antibodies to fight them, in which those antibodies stay for a very long time, and in many cases, for the rest of the person's life. If the person is exposed to the disease again, the antibodies can fight it off without the person ever getting the disease.
There are sometimes side effects to a vaccine, such as swelling or redness at the area where the injection happened, but these are very mild, and usually go away within one or two days. More serious side effects have been reported, but they are very rare.