I've never heard anyone say Chicago was dirtier than San Francisco before, and I'm just going to assume you've never spent any time here.
Berwyn isn't Chicago.
Wicker Park, Uky Village, and Bucktown are all essentially the same neighborhood --- they're adjacent, clustered, and only a few square miles; they're Chicago's version of SOMA or Greenwich Village. And yet they're tree-lined (right now, they're covered in fall canopy), and every street there has an alleyway, where the trash goes.
NYC and SF are dirty in large part because they are poorly planned.
I don't know why you think Noe Valley is covered in poo, though. Noe Valley seems no more or less filthy than the nicer areas of the Castro.
I found that observation a bit odd. The part about North Beach being clean was also a bit suspicious. Whenever people make blanket claims about how dirty SF is, I wonder if they've ever been to the western half of the city.
If Noe Valley is covered in poo, at least it's dog poo.
My point was, I lived in really crappy SF, I lived in hipster urban SF, and I lived in residential SF, and they were all filthy.
This is the first thing that I noticed when visiting New York for the first time. The place stunk, because the sidewalk was half for garbage and half for pedestrians. I just couldn't believe it.
(Pittsburgh is like this too. I remember having to literally move boxes of garbage away from the doorway to a restaurant to get inside. Not a great way to start your meal. The food ended up being bad, too, and I got a big piece of paper mixed in with my food. I don't think I ate anything for the rest of that conference...)
Anyway, Chicago has its problems, but it is certainly nice-looking and well-designed. I have not visited anywhere else in the US that is as clean.
(Tokyo and Copenhagen are similarly clean, though. Even Hong Kong is better than New York.)
The other big problem with SF is the parking. Horrendous. And yes, many of the people there do seem to spend a great deal of time in an advanced state of self-congratulation.
Only for certain unusual values of "everywhere." Even in Manhattan, certain neighborhoods are very clean; venture out into Brooklyn, where far more New Yorkers actually live, and the trash dynamics totally change.
Of course, this is true of all generalizations of New York. The city is so enormous that it's possible to go for decades without realizing that the part you live in is actually just a small part of a large ecosystem. So when anyone (especially a New Yorker) says "New York is..." the first move to understanding what they're saying is to ask what neighborhood they live in. Conclusions about "what New York is" are going to be pretty different coming from someone living in Park Slope vs. Chinatown.
In fact, for a city of this size it's quite well maintained.
The climate may suck, the public transportation a joke, the government corrupt as hell, but doggone it, it's clean!
As a life-long Chicagoan I still find it incredibly strange that people believe Chicago is safe. It has a very high crime rate, double NYC in every category.
That's because the NYC summer is hot, not because the city is dirty. (Maybe you have oily pores?)
That's true, but it's still a dirty city. However, it's a different type of dirty than SF. The dirty parts of SF are dirty due to insanity and apathy. NYC is dirty because there are so many people out and about, all the time.
SF is dirty in the gross parts, but it's not as dirty as places like Chicago, NYC or even Paris. It just so happens the dirtiest parts of SF are where startup people work and hang out: SOMA, Tenderloin, the Mission. The level of dirtiness in these areas is so off the scale (one regularly steps over human poo) that it warps one's perspective as to how dirty the city is in general. In contrast there is a layer of garbage and grime everywhere in New York City. So much so that after a day of walking around in the summer, you can turn a white handtowel black just by wiping the sweat off your brow...