Upvote:4
One cheap option would be to visit a public swimming pool, like the Mission Community Pool, for $6. Hours are more limited than a for-profit business.
Upvote:5
If you're flying into SFO, there is a business called Freshen Up in the airport. It won't be free, but for $25 you can, well, freshen up before you head into the city (sadly, their shorter cheaper option seems to be gone, at least from this price list).
Many local gyms will have shower facilities and sell day passes. This will likely cost you around the same as Freshen Up, but could be worth it if you're interested in working out too. I can point you to one if you have a specific neighborhood in mind.
Limited free shower facilities in San Francisco do exist, but are really intended as services for homeless people rather than travelers. If you're just looking to brush your teeth and splash some water on your face, that can be done at the airport or local malls or hotel restrooms.