Thank you everyone for commenting. It is looking like Chocolate milk was the problem. Last Friday was her last day having Chocolate milk and the symptoms are gone. I talked to her teacher and we put her back on White milk, which she was initially on in the beginning of the year, and then switched to Chocolate milk only for a week and we had many accidents and upset tummy! No accidents in a week!
The timing seems to coincide with a major change in her life- starting kindergarten. anxiety can cause loose stools, and if anxiety is the cause, then she may be too anxious to ask to go to the restroom. Another thing you may want to look at is a change in diet. Is she getting school lunches or snack at school? If so, she may be getting something she can't tolerate, such as dairy as someone suggested. Or, it can be due to a mild stomach bug, which also often happens when kids first start school. They are suddenly being exposed to all sorts of new bugs. Some mild stomach bugs can have symptoms that last a few weeks. Cutting dairy and increasing starches can help the digestive tract heal, if that is the case. You can always consult your pediatrician as well.
She might have a bowel impaction, where only a little liquid poop gets around it, and comes out without her really being aware it is doing so. Please look up the topic, impacted colon or impacted bowel, and encopresis. Then if this looks likely, take her to see her doctor or a GI doctor. You don't want her to be set up for a lifetime of dysfunctional bowels.
If I were you I would cut out all dairy to begin with. Next I would take her to a doctor. There are many things that could be wrong. Among them would be Chrons/Coliits, IBS, or even Ciliac Disease. That is just some of them many things that could be wrong. I hope this helps.
I would suggest to you that she needs to go' at school and at 5 year old is too embarrassed to ask the teacher, it would be a good idea for you to discuss with her that when she feel the need to use the bathroom for which ever it is, she quietly asks teacher to go..it s a matter of communicating she needs to use the toilet , children do not like to ask and teachers are remiss in making sure they go ...