When you are given the shots, your body learns to fight them and becomes immune, or resistant to them later on in your life. Not all microorganism are bad. Some of them help us in everyday life. The fermentation of wine, or making wine from grape juice, requires the help of certain microbes. The vaccines doctors give are made of microorganisms.
Scientists also make medicine using microorganisms to fight other microorganisms.
Penicillin, for example, is a type of medicine taken from microbes that can kill bacteria in your body. So in reality, microorganism are not all harmful and can even be helpful. Microbiology is a very interesting topic that you may want to explore in the future. For now, remember what you learned today about the little teeny tiny lives around you and always wash your hands.