Our homeless crisis is determined by factors unrelated to the amount of housing (though it used to be, and it’s important to build new housing in general) - nowadays we actually import homeless people to places like SF.
As to San Francisco homeless coming from outside the Bay Area, that's true for only around 10% of the population. Most (70%) became homeless in San Francisco and many others became homeless in other parts of the Bay Area. See the `PLACE OF RESIDENCE` section from https://hsh.sfgov.org/wp-content/uploads/2020/01/2019HIRDRep...