A toddler will experiment with his/her genitals; its normal. What to do:
- Get him/her involved in doing something else.
- Without frightening them, tell him/her not to do it in a nice way.
Remember there might be germs in his/her hand that may cause irritation and infection in the genital area, and vice verse; there are germs in the genitals that can cause stomach viruses. You should follow that with a nice warm bath or washing hands after. Do not scare, spank or make the child feel bad, do not act as if its embarrassing to do it. This is the most natural thing in the world and he/she will outgrow this.
When he/she is old enough to understand about hygiene you should tell them the risks involved to both areas if they do that; and its perhaps a good time to let them know not to do it in public; for safety reasons.
For professional advice, please look into this page: http://www.drgreene.com/21_606.html