vaccines inject a dead or very weak version of the disease, into your blood. they have it weak on purpose, it simulates your body actually having the bacteria/bug in you, without the bug being able to hurt you. your body fights it off, and remembers how to fight it off, so when you actually do get the disease, your body can fight it off quickly.
if you don’t get a vaccine, your body has to learn to fight it off while the disease can fight back and cause damage, and can possibly harm you bad enough before you learn how to fight it, making it too late and you could die.