The penis may be rubbing on his clothing & with irritation, he touches it. He may be stimulated otherwise. Gently discourage this with the least of admonishment & try to talk to him about not doing this when it public. Don't make a big issue out of it. It could cause more harm than good. Certainly don't embarrass him. A good thing would be to pick him up/hug him.