Please allow me to explain.
The statement “if you are vaccinated, you are protected against the disease” is really a simplification. In reality, the statement should read “if you are vaccinated, there is a 95% chance that you are protected against the disease”.
Now this 95% varies, it depends on the disease against which you are vaccinated, and it depends on the vaccine. But it’s a quite common number, so let’s use it as an example.
This means that 5% of those who are vaccinated, are not protected. That’s because vaccination sometimes just doesn’t work, for various possible reasons.
Normally, the fact that 5% of children is not protected against the disease is no problem. That’s because the other 95% of children are properly protected. Therefore, the disease cannot spread through the population. Even if the virus is imported from abroad, it will quickly die out in the vaccinated (and thus largely protected) population.
This is called group immunity. It means that though some individuals are not immune, the group as a whole is immune.
I wrote about this before. Please refer to my earlier post; start reading after the last highlighted word.
I hope this answers your question.