Hello and thank you for posting your medical question on E health Forum.
It seems that your kid was probably masturbating.
As a boy grows, he explores and experiences the changes in the genitals, and the pleasure he can derive by stimulating them. As most kids, he enjoys the pleasure provided by his own body.
It is completely normal physiological reaction and completely safe for him to masturbate.
Contrary to belief, masturbation has no effects either on maturation, penis size or future fertility.
I hope this helps.