Oh my,that is a funny and akward situation! I sm sure every mom has a child find the tampon in the purse, or sees the dispenser in the ladies room, or even a commercial on TV and asks that very question.
My son and daughter have pulled a tampon out of my purse when looking for gum and I have said that it is something for mommies and thankfully that was enough. I can tell you that my 4 year old asks what the little garbage cans in the stalls are for and really got a kick out of opening and closing the lids and the cans while waiting for me - yuck. We had a talk about germs and it was resolved.
Now, in your situation, I would not go into graffic details with 6 and7 year olds. It is a need to know basis at this age and they really don't want all of that information anyway. I would answer his questions in a truthful, but simple sentence or two. Like, "This is for grown up ladies to use sometimes to stay clean." If they want to know what's in the machines try something like, "those are items mommy might need to use in the bathroom to help her stay clean after she goes potty." See if that works to answer the need to know,but without overwhelming a little boy.
Also, I have taken my older son(now 8, but then 7) into the ladies room just for safety sake in large public venues (zoo, airport, etc) and he uses his own stall, but can easily talk to me if he needs to through the divider. I do not allow him, and now more frequently my little girl (4 1/2) to share the stallwith me, especially at that that time of the month. I tell them, "You go in here so you can have some privacy,and I will go in the potty next door. When you are done, if you beat me, you can stand outside of my door and I can see your shoes so I know you are ready to wash your hands with me." I also tell them that if I am done first, I will stand outside of their door so they can see my shoes and know where I am.
Good luck.