Hirschfeld was born in Kolberg (now Kołobrzeg, Poland), in an Ashkenazi Jewish family, the son of a highly regarded physician and 'Medizinalrat' Hermann Hirschfeld. In 1887–1888, he studied philosophy and philology in Breslau, then from 1888 to 1892 medicine in Strasbourg, Munich, Heidelberg, and Berlin. In 1892, he earned his doctoral degree.
After his studies, he traveled through the United States for eight months, visiting the World's Columbian Exposition in Chicago, and living from the proceeds of his writing for German journals. During his time in Chicago, Hirschfeld become involved with the homosexual sub-culture in that city. Struck by the essential similarities between the homosexual sub-cultures of Chicago and Berlin, Hirschfeld first developed his theory about the universality of homosexuality across the world, as he researched in books and newspaper articles about the existence of gay sub-cultures in Rio de Janeiro, Tangier, and Tokyo. Then he started a naturopathic practice in Magdeburg; in 1896, he moved his practice to Berlin-Charlottenburg.
Hirschfeld first became interested in gay rights when he noticed that many of his gay patients were committing suicide. In the German language, the word for suicide is Selbstmord ("self-murder"), which carried more judgemental and condemnatory connotations than its English language equivalent, making the subject of suicide a taboo in 19th century Germany.
In particular, Hirschfeld mentioned as a reason for his gay rights activism, the story of one of his patients: a young Army officer suffering from depression, who killed himself in 1896, leaving behind a suicide note saying, despite his best efforts, he could not end his desires for other men, and so had ended his life out of his guilt and shame. In his suicide note, the officer wrote that he lacked the "strength" to tell his parents the "truth", and spoke of his shame of "that which nearly strangled my heart". The officer could not even bring himself to use the word "homosexuality", which was instead conspicuously referred to as "that" in his note. However, the officer mentioned at the end of his suicide note: "The thought that you could contribute a future when the German fatherland will think of us in more just terms sweetens the hour of my death". Hirschfeld had been treating the officer for depression in 1895–96, and the use of the term "us" led to speculation that a relationship existed between the two. However, the officer's use of Sie, the formal German word for you, instead of the informal Du, suggests Hirschfeld's relationship with his patient was strictly professional.
At the same time, Hirschfeld was greatly affected by the trial of Oscar Wilde, which he often referred to in his writings. Hirschfeld was struck by the number of his gay patients who had Suizidialnarben ("scars left by suicide attempts"), and often found himself trying to give his patients a reason to live.