*Adding this: I'm wondering if he perhaps has a yeast infection? My son did that a couple times, when he had this. It'll look like a diaper rash.. but with different demarcations. Check with your Pediatrician.
My son does the exact same thing, whenever he is naked.
And he thinks its funny and he goes running around the house, naked, doing it. He thought it was funny, until his fingernails actually nicked his skin... then it hurt. Like a paper-cut would. Ouch.
So, he sorta learned from that, and is more careful now.
Boys, like to grab/pull/itch/stretch their privates.
I think it's partly self exploration and part them just being boys... even men "itch" themselves... not that it's attractive... LOL
If a boy is not circumsized... this grabbing/pulling on themselves actually is a NORMAL thing which "helps" the skin to naturally stretch/grow with them and then helps the skin to 'retract' later... so it's sort of a natural thing for them to do. For us, my Hubby said let my son do that... because it will help his skin to retract later... he even read about this online... and it helps them to get used to themselves & their own body... and later when you need to teach them to clean themselves etc.
But yes, if you have concerns ask your Pediatrician.
All the best,
Susan