It’s normal for babies to discover their genitals just as they discover the rest of their bodies – and if touching them feels good, they will repeat it. It’s nothing to worry about and it’s best to simply take no notice.
While touching their genitals is completely natural in young children, it’s generally not considered socially appropriate for them to do it in public. The best approach is to teach your child the difference between public and private as soon as he’s old enough to understand – what is fine in his own room at home is not OK in the library or on the bus. Try to tackle it in a way that makes your child feel comfortable rather than ashamed: use a neutral tone of voice and avoid punishing him for this behaviour.
If genital touching continues despite repeated conversations and reminders, you may want to see your GP who can make sure there’s no physical reason, such as soreness or itching. Rest assured, though, as with most habits your child will soon grow out of this phase.