San Francisco differs from Chicago on homelessness in two significant ways: the weather and environment is amenable year-round, while Chicago is inhospitable for 1/4 of the year, and San Francisco's politics regarding homeless people are "hands-off".
Based on the last spot counts I could find, Chicago and San Francisco have roughly comparable homeless populations, despite the fact that Chicago is more than 3x larger. That difference is not simply because Las Vegas busses homeless people to SF.
I dispute the notion that SF does a particularly good job taking care of homeless people. It's indeed possible that SF does a better job of this than Chicago and NYC, both of which see clusters of indigent people on the streets as a quality-of-life problem for residents. But if you can find a source that says SF is doing a good job of actually delivering services and getting homeless people off the streets and into society, I'd like to read it; the sources I've found say the opposite.