IANAH, but I am have a background in molecular biology, so infectious disease history is kind of right up my alley.
This is an highly complicated question, and any answer runs the risk of running roughshod over a whole bunch of identity politics, but I'll do my best to be as respectful as possible while still relating the facts as I understand them.
Most modern theories point to HIV first crossing over to humans early in the 20th century in what is today known as the Democratic Republic of the Congo. Because it is so slow to show symptoms or cause illness, it ends up spreading to a rather large number of people over the next few decades, before being brought to Haiti. In Haiti, it spread through the blood/plasma donating population due to improper sterile techniques.
(Source: Spillover by David Quammen--HIGHLY RECOMMENDED if you are interested in emerging infections)
Once it found its way to the US (the precise details of this are unclear), the disease quickly gained a foothold in the vibrant and highly promiscuous gay subcultures of the late 1970s. Because the disease takes several years to show severe symptoms, many people were infected long before anybody even knew what was happening. Then, in the early 80s, doctors in New York and California started reporting young gay men with bizarre diseases that almost no healthy person should ever get, including Kaposi's Sarcoma (a form of skin cancer) and a variety of fungal or bacterial infections.
The disease also found its way into the populations of IV drug users very early, who spread it from person-to-person by sharing needles. Unfortunately, there is less info on these early victims because many of them were destitute or homeless, so many of them never sought treatment. I mention them because it is important to stress that HIV did NOT come out of the gay community and the gay community alone. It had several avenues into modern society--the gay community just happens to be the best documented, as far as I know.
For a variety of personal, political, and institutional reasons (for which, see my source below) almost nobody wanted to admit the possibility that what was then called "Gay Related Immune Deficiency" (GRID) was infectious. Owners of gay bathhouses in San Francisco, LA and New York refused to enforce condom use. Gay men refused to curtail their sexual escapades. The Reagan Government basically ignored the problem, devoting almost no money to the CDC's efforts to ID and curtail the infection. The media basically ignored the problem because it wasn't okay to discuss "gay problems". In fact, much of the gay community ignored the disease until Larry Kramers now-famous screed "1,192...and counting." If you've never read this, you really should.
The scientific and medical communities are--unfortunately--not without significant blame here as well. The early research in to AIDS/HIV was fraught with politicking, personal vendettas, and self-promotion, all while men and women were dying of the disease. Not one of the american scientific communities best moments by any means.
Many gay men and IV drug users in expensive cities like NYC or SF supplemented their incomes by selling blood and blood plasma. Because of this, the disease started appearing in people who received blood transfusions and hemophiliacs (who rely on drugs based on human plasma for increased quality of life) and kept on spreading from there.
If you want to know more, I suggest you read Larry Shilt's "And the Band Played On." Written in the late 80s, it's a highly detailed--and completely devastating--account of the early years of the HIV epidemic, with focus on the gay community. The author--a gay man himself--was tested for AIDS while writing the book, but refused to see the results until he had published the work. The test was positive, and he died of AIDS-related complications in 1994.
Tl;Dr: It's complicated, and there's plenty of blame to go around.
edit: Oh, if you want the condensed version of "And the Band Played On" , HBO made a film version (with Ian McKellan!) that you can find stream if you have Amazon Prime.