I entirely agree with treemarks. My little sister used to do this right from very small. We treated it casually. No big deal. She grew out of it. Natural curiousity I think.
Its time to see a physic this behavelor is not unherd of she needs to have her question ansewered by a pro or you will have to ansewer the question yourself, tell her her hormones are coming to life as with all little girls and it happens different with each child ok?
Natural curiosity. They will grow out of it. Both my kids children did it - I just redirected them. We just casually say "Hands out of your pants. Let's go wash your hands" No biggie. They soon grow out of the curiosity and learn that it's socially inappropriate.
Self stimulation is quite normal in young children. Whatever you do, don't try to make her feel as though it's dirty or wrong. However, it's not appropriate to do it in public or in front of others, so you must try to make her understand that.