Yeah he picked probably among the worst neighborhoods to live in. I have noticed this is a recurring pattern among single male tech friends I have to move to Soma due to office proximity and then end up hating the city.
Alot of this is due to the policy decisions of Ed Lee(ex SF mayor). He authorized tax breaks for a bevy of tech companies to operate in the tenderloin tax free(for a few years). The reason for this was to revitalize a blighted neighborhood with an infusion of highly paid tech workers. This is turn lead to a huge amount of tech employees moving to one of the worst areas in SF. Sf for sure is falling apart but I did spend some time recently in the sunset and things seemed pretty normal over there - at least in broad daylight, but everywhere else I visited was not great at all.
Zoning laws basically make this the reality in every major city's downtown area. They aren't allowing offices or building new multistory buildings in the safe NIMBY areas of cities.
It might sound like an overt policy but in reality it's just the easiest one without doing any real reform or dealing with any of the problems. Like all municipal housing/development policy in the last two decades.
Zoning rarely changes, what's does always change a) the natural expansion of economically productive downtown areas and b) the degree to how bad it is in those very high traffic areas while everyone pretends you can just easily not visit those areas and be fine (despite there being few options to work or build elsewhere).
Bad zoning policy is probably the largest driver of most things that are killing cities -- it encourages wealth disparity, bad land use, increased emissions, and concentration of crime. Unfortunately, wealth is a driver of bad zoning policy, so it's a bit hard to get out from under it -- and some of the examples of "fixing" zoning are equally terrible, e.g. Houston's complete lack of zoning and incredible sprawl.
People move to SOMA because the apartments are both close to their office and easily accessible online. Finding apartments in the rest of the city can be something of an adventure.
But then, as you note, SOMA is kinda bad to live in. Lots of homelessness, not a whole lot of services, everything shuts down outside of business hours.
If you feel uncomfortable around homeless people, there are plenty of other areas that the city allows housing construction, like the Dogpatch area without large homeless populations. I would not necessarily recommend that area either, but it is a tradeoff.