San Francisco has human feces because it is one of the only cities in the USA which has not completely criminalized homelesness, because there are a lot of services there, and because once people decide that San Francisco is home, they really, really, really do not want to leave.
First of all, there are plenty of human feces in Oakland, but again, let's try and crawl away from that lens. If you become homeless in Oakland, the best advice I can give you is to spend your last $5 on a BART ticket to San Francisco. Oakland and a lot of Alameda County's solution to these sort of problems are a humongous jail called Santa Rita which is comparable to the size of the nearby San Quentin prison. Most of the people in there are there for minor crimes related to homelessness or poverty, and their situations escalate once they enter what is a major portal to our for-profit prison system, which per-capita is the most heavily populated in the world.