A vaccine is a very weak strain of the disease they are giving you the injection to prevent. By giving you the weakened version your body has a chance to build up a natural defence so that if you are exposed to the full blown disease you will be immune to it.