This question has been covered quite a bit since the pandemic, and it's not unique to San Francisco.
In short, orgs need less office space than they did in the past, and commercial real estate is not easy to convert to residential. Plumbing, electrical, fire codes, and so on.
Plus, commercial landlords are used to sitting on vacant properties waiting for "whale" clients who will sign 10+yr leases.