Establish a very firm limit with your son: he can touch his penis only when he is alone in the privacy of his room. He is not to do this in your presence or in the presence of anyone else. There's no need to punish him - rather, be firm about the limit. There's likely nothing amiss medically, but have his pediatrician examine him so that you can be sure you're not overlooking anything. Be sure he is receiving sufficient opportunities to engage with peers and participate in age-typical play opportunities. If he attends nursery school or some other form of pre-school arrangement, check with the staff to see what they are observing. Nothin in your note indicates the need right now for professional intervention, but if his mood and/or behavior deteriorates, have him evaluated by a pediatruic mental health professional (clinical psychologist, psychiatric social worker).
Nikki