The injectable vaccine for polio stops the symptoms, but it doesn't stop the propagation of the virus from person to person.
The oral vaccine for polio also stops the propagation (that is better) but it is a live virus that can escape and produce polio in other unvaccinated persons (that is bad).
[So the current recommendation is to use oral version when polio is endemic, the injectable version when there has been no cases for a few years, and a mix of them in between.]
Normally when you get infected you get small number of viral particles in your system. Those then hijack your system to create more, and those new particles spread to other people through sneezing etc. In time your immune system learns how to recognise and kill the virus and eventually removes it from your system.
Now let's say you get vaccinated and you get that same small number of viral particles in your system. Your immune system will already know how to recognise and kill the virus, and immediately starts doing this. It doesn't multiply in your body, so it can't spread to others either.