Well in my words, The vaccine is the weakened or dead version of the virus(pathogen). This actually prepares the body to be un-affected if it ever comes in contact with the virus (pathogen) again. After the vaccine is injected your body produces memory cells. These help your body become immune to the same virus (pathogen) twice. So basically it helps protect your body from dangerous viruses or pathogens, and develops immunities against them.
I really hope this helped :D