San Francisco has a reputation in America as being among its most socially liberal and accepting of LGBT people. Given that most major metropolitan areas tend towards social liberalism as a general rule, and that LGBT people had communities in most if not all major American cities, why did San Francisco get singled out as being "gayer" than the others? What made it stand out in this regard?
Why not, for example, New York, home of the Stonewall Riots? (New York, of course, is also seen as "pretty gay," but not to the same extent as it seems for San Francisco.)
And for bonus points: if any other cities had the reputation as the town where there was an unusual number of LGBT persons, what were they, and when did they hold this title?
SF has a history of being very progressive on many fronts. As for the LGBT part I believe the most important factor that solidified SF as a community of LGBT acceptance was the election of Harvey Milk. Milk came to SF from NY during a time when many gay people were moving to the Castro district to set up a sanctuary community for gay people. (This is also why The Castro is seen as the epicenter of gay culture in SF). He wasn't the first gay man to be elected, but he was the first non-incumbent openly gay man to be elected in the US. This basically means he was the first person that Americans elected for office with the prior knowledge of him being gay. During his tenure as a board member of SF city supervisors, Milk passed some progressive gay rights legislation, leading to SF being a city known for their acceptance of gay people. Milk only served for 11 months before being assassinated along with Mayor Moscone of San Francisco. This tragedy solidified Milk as a martyr of gay rights not only for San Francisco, but for America as a whole.
Some helpful geographical context for your question.
While the SF Bay Area is a massive metropolis, San Francisco never absorbed the surrounding areas in the way that New York City and Los Angeles did. (Metropolitan consolidation failed in 1912 after Oakland's voters, across the Bay, axed an annexation referendum.) This means that SF proper is a small portion of the urban core, and has no large, traditional suburban neighborhoods within its 7x7 which would tend to dilute the percentage of gays and lesbians living within the "city," who tend to congregate in urban cores.
As of 2015 (I don't have the old Census data in front of me), the City and County of San Francisco had about 850,000 people out of a metropolitan population of 8.7 million. That's under 10% of the metropolis. And this is quite different from other major cities. (LA is 4 million out of a metropolis of 18 million; NYC is 8.5 million out of 23m.) But LA has the postwar suburbia of the San Fernando Valley; same for NYC, which has eastern Queens, the streetcar suburbs of outer Brooklyn, and most of Staten Island. This means that the LGBT percentages in other major cities are relatively diluted compared to San Francisco, which has kept its boundaries since the county lines were last changed in 1856.
In How to Kill a City: Gentrification, Inequality, and the Fight for the Neighborhood, Moskowitz talks about how SF got their LGBT community because the military would discharge gay servicemen at pacific coast bases. He doesn't get into specifics about the base or whatnot, but cites that as the beginning of the gay culture in SF that allowed for a concentration and shift in culture that eventually allowed for the election of politicians like Harvey Milk and the rise to national prominence as a gay friendly city.