Vaccines allow your immune system to familiarize themselves with potential invaders. This is helpful, because viruses are tricky. They sneak around your body and often have the chance to make you sick before your body can figure it out. Figure it out, body!
Viruses are like wedding crashers. When you're dealing with a lot of people coming and going, it's really easy to let someone in who wasn't invited. But, if you know the uninvited person, such as the bride's crazy ex-boyfriend, you'll know right away to bust him. That's what vaccines do. No, they don't bust ex-boyfriends. I mean they get the immune system acquainted with future intruders. It's like circulating a picture of the potential wedding crasher so everyone can recognize him.
I wonder if my analogies are getting stale. Back to reality for a moment: vaccines are weakened or dead viruses that you inject into the body.