A vaccine is a substance injected, or taken by mouth, that is a weak version, or a similar version to disease-causing microbes. It is mainly made from weakened or killed microbes. Some vaccines are made from weakened versions of the poisons the microbe releases. Others are made from parts of the microbe (proteins).
When something like this enters the body, the body's white blood cells rush to destroy it, and they remember what it is like, so they can more easily kill it in future. Some people have a mild form of the disease while this is happening, but most people notice nothing at all.
Vaccines are one of the most powerful ways of preventing disease we have. There are vaccines for most of the main world killer microbes.