How many of us do actually know that Vaccinations are nothing else but the same disease causing antigens for which you are being given the vaccination? Yes, this is true.
For example, Hepatitis is caused by HPV (Hepatitis B Virus) and the vaccination for hepatitis actually contains HBV in dead or weakened forms. This is done to make your body ready for fighting the disease when these antigens actually attack on you in large/severe amounts.
We have two kinds of cells in our body which are used to fight diseases: B cells and T cells. Whenever an antigen attacks our body for the first time, these cells create a code to fight those antigens. Once the code is created, next time the antigen attacks, these cells are able to fight the antigen very fast as they already have the code created for that specific antigen.
Hence, we are given antigens in the form of vaccinations so that the code for fighting them is created in our body and when they attack in large amounts later in our lives, our body can fight them back fastly.