Vaccines work by giving you a little bit of the thing that will make you sick, but not so much that you die from the exposure. Your white blood cell army, as part of your immune system learns the nature of the invader, and sends out updates to all the other cells about how to defeat the threat. If the white blood cells communicate the risks fast enough, like a police description of a bank robber, then they will be able to out-number the pathogen and defeat it.
Think of the ‘no’ as a threat that you want to train your body to react differently to. You can consciously and safely expose yourself to ‘no’ and build up your immunity to them.