Sometimes a child can encounter some discomfort and trepidation around the idea of using a public restroom.
Most kids, at least at first, can be averse to using public restrooms. Not too hard to imagine why when you look at it through a child's eyes. The loud noises, the cold, hard surfaces, strange people coming in and out...
I'm an adult and even I don't love having to use a public restroom!
Try to be patient with your child as you are easing them into using the toilet outside of the comfort of their new home. Start by exploring bathrooms in other places, like a family member or a friend's house, for example. Then try going into a store with a single stall bathroom, and then progress from there. When you're in a strange bathroom, engage your child in a game of "I Spy" to lighten the mood.
Another great trick is to keep a pad of post-its in your bag to place over the motion sensor when they are using the toilet. This will prevent it from flushing at an inopportune time and startling your child!