The first time I visited a hot spring in Japan, I was surprised while undressing by a middle-aged staff woman announcing "excuse me!" To the entire room as she entered. All the men were in various states of undress, as we were readying for the bath. No one else batted an eyelash, so I just went with it as well. This was a long time ago; I am no longer surprised when a woman walks into the men's locker room.
Yesterday I was finishing up at the gym, when a woman announced that she'd enter. I head for the shower, wash off, and begin to exit, when the one other guy in there looks back and forth between me, and the cleaning staff member on his other side. He's doing this multistage double take which I realize means I shouldn't be naked just now. She has her back to us, so I retreat back into the shower room, and the guy lets her know I'm waiting to leave the shower. She leaves in a hurry.
So, apparently, in Japan the female cleaning staff can come into the male locker room, but at a hot spring it is a matter of course, but at a gym they can only do it by permission and when men are clothed.
Or maybe the one guy in there thought that, as a foreigner, I was about to be embarrassed.