If you belong to that gym, of course. I see people come just to find a place to change out of or into their business suit without having to drive 50 miles home and back. I've seen bums who still have a valid membership use the showers and just hang out out of the rain. But you can't just come in without a pass, unless you sneak in or get a visitor's pass. Some gyms do offer a day pass where for $5~ you can use the shower if that's what you want to do.
Truck stops have showers that cost closer to $10 but you won't get the odd looks and they might be more conveniently located for travelers. If you have to, state parks or campgrounds have showers that depending on the state, have varying rules and/or payments. Worse comes to worse there's always the gas station bathroom paper towel and hand soap method. Or f--k it, real travelers just jump in a river or creek they may be passing.
Traveled far and wide and taken (and missed) many showers.