Some places have laws designating genders for specific bathrooms. In most cases, however, the police rely upon the catch-all of “disturbing the peace,” which can pretty much be employed to fit any situation.
I have never heard of a legitimate transgender (BTW, it’s “transgender”, folks, not “transgenders”; nor are we “a transgender”) person in real life going into the ladies room presenting male. I’m sure it happens, but it’s vanishingly rare. I don’t know of anyone in my community who wouldn’t react with horror over such a thing.
The difficulty in enforcing any “disturbing the peace” ordinance comes about when the transgender person has all female ID. Such as me, for instance. Even my Social Security and passport information says “female.” So what would a court really do? “So officer, a person went into the ladies room, did their business, washed their hands, and walked out - and you arrested them, even though they were presenting as a female, had female ID, and there was no evidence of any private parts being exposed to anyone else?” My best friend, a fire-breathing transgender attorney, would have a field day with that lawsuit.
So what if you have no legal ID which says “female?” Some of us, especially when new, have “carry letters” from our psychologists and/or physicians stating that we have been diagnosed transgender, we are not up to any funny business (presumably), and giving 24-hour contact information for the doctor. Often the police will be satisfied with that. But you can always catch a cop on a bad day. Or a bad cop.
Almost always, it never gets as far as the police. The first line of outrage is the cisgender women themselves who may be offended or scared - I’ve had to calm them down when I’ve taken someone who doesn’t “pass” into the rest room on a couple of occasions. The next line of outrage is the establishment manager - again, typically they won’t call the cops if everyone is reasonable, although they can ban you from ever coming in.
It’s getting better, in the United States. Each year it’s less and less an issue. Each year it seems the number of horror stories of transgender women abused and beaten for using the bathroom in accordance with their gender presentation declines. So I keep fighting, every year, until it’s not an issue any more.