Doctor pulling back babies foreskin!?

So everytime we go to the doctor, she pulls my sons foreskin all the way down to examine. But I know you aren’t supposed to do that? It doesn’t seem to bother him but it make me anxious. Are they supposed to do this and why?? He’s 5 months old now