This is mostly the result of (a) voter-mandated, retroactive benefit increases and (b) courts forbidding the city (and voters) from rolling back those retroactive increases. See
https://calpensions.com/2017/07/03/san-francisco-pension-deb...
The following case relates to just one particular benefits measure:
https://www.sfexaminer.com/news/sf-loses-lawsuit-against-may...
City leadership itself has been relatively fiscally responsible. For example,
https://www.sfchronicle.com/bayarea/article/SF-taking-steps-...
Which is actually quite impressive, IMO, because the pressures to spend are enormous, and the city does indeed spend quite a lot. The politics at the Board of Supervisors is intense and there's a large populist faction that would like to spend much more. But at the end of the day what really matters is who is elected to City Hall, and at least when it comes to fiscal responsibility Newsom, Lee, and now Breed put a strong emphasis on long-term budget viability. But sometimes--like with voter-mandated expenditures--their hands are tied. Mayor Breed opposed the recent Prop C which raised several hundred million in new revenue for spending on homelessness. (She supported a similar future ballot measure, but wanted to wait things out. Working under Mayor Lee she already had a sense of what was in the pipeline and wanted to see how those initiatives developed. And Lee and others were expecting another downturn very soon so were more concerned with shoring up the budget to avoid having to make deep cuts.)
EDIT: Also, the growth in healthcare costs is eating everybody alive. What should really worry people is whether California voters mandate single payer. Because California is limited in how it can control cost growth--most policy control resides in Washington, e.g. pharmaceutical regulation--it'll be a huge problem. But we won't be able to blame politicians for it.