The "Dictionary of American Slang" reports that gay (adj.) was used by homosexuals, among themselves, in this sense since at least 1920.
Rawson ["Wicked Words"] notes a male prostitute using gay in reference to male homosexuals (but also to female prostitutes) in London's notorious Cleveland Street Scandal of 1889.
Ayto ["20th Century Words"] calls attention to the ambiguous use of the word in the 1868 song "The Gay Young Clerk in the Dry Goods Store," by U.S. female impersonator Will S. Hays.
The word gay in the 1890s had an tinge of promiscuity, a gay house was a brothel.
The suggestion of immorality in the word can be traced back to 1637.
Gay as a noun meaning "a (usually male) homosexual" is attested from 1971.
This happened around the late 60s early 70s rather then use the word homosexual they used the word gay because it sounds a lot better.
I think it is just because the want to be happy. They want be able to be happy with the person they love
The term "GAY" to imply homosexuality was correctly started with LIBERACE in the late 1950's.
The Pianist LIBERACE (Lee) sued the London "Daily Mirror" & the US "Confidential" for defamation. Calling him a "fruit flavor man" they both insinuated that he was homosexual. Liberace won his lawsuits.
Journalists afraid to also be sued, continue to mock him, but instead referred to Liberace as ... being light and "GAY".
They had dare to borrow it from LIBERACE'S very own TV Show Theme-Song:
I'LL BE SEEING YOU ... (in everything that's light & GAY, I'll always THINK OF YOU THAT WAY).
How could Liberace now possibly sue them, if he himself, uses that term on his own TV Show.
The (wink-wink) veiled insinuation gained momentum with time and
the new meaning became popular by 1970.
These types of questions can be very difficult to answer, as through-out history, the meaning of words can tend to change or be used in different context.
The term gay was originally used to refer to feelings of being "carefree", "happy", or "bright and showy"; it had also come to acquire some connotations of "immorality" as early as 1637.
The term "gay" as used to reference "male homosexuality" may date as early as the 19th-Century. It's use gradually increased in the 20th-Century.
First let's look at the word, Homosexual, is a Greek and Latin hybrid with the first element derived fromt he Greek ὁμός homos "same" (not related to the Latin homo, "man" as in Homo Sapiens) thus connoting affections between members of the same sex, including lesbianism.
The first known appearance of "homosexual" in print is found in an 1869 pamplet by the Austrian-born novelist Karl-Maria Kertbeny, publish anonymously, arguing against Prussian anti-sodomy laws. In 1879, Gustav Jager used Kertbeny's terms in his book, "Discovery of Soul" (1880). In 1886 Richard Von Krafft-Ebing used the terms homosexual and heterosexual in his book Psycopathia Sexuals, probably borrowing them for Jager. Krafft-Ebing's book was so popular among both layman and doctors that the terms "heterosexual" and "homosexual" became the most widely accepted terms for sexual orientation.
As such, the current use of the term has its roots in the broader 19th-Century tradition of personality taxonomy.
Note that the term homosexual was used to describe anything of "one sex" orientation, such as an all girl or all boys school, though not related to one's sexual orientation. Today,the term is exclusively used to describe sexual orientation and the term "homosocial" is now used to describe single-sex contexts that are not specifically sexual.
The term gay was originally used, until well into the mid-20th century, primarily to refer to feelings of being "carefree," "happy," or "bright and showy"; it had also come to acquire some sexual connotations as early as 1637. The term then began to be used in reference to homosexuality, in particular, from the early 20th century, a usage that may have dated prior to the 19th century.
In modern English gay has come to be used as an adjective (occasionally even as a noun) that refers primarily to homosexuality. The newer meaning of "homosexual" was used simultaneously with the old meaning of "happy" from around 1960 to 1970.
By the end of the 20th century the word gay was recommended by major style guides to describe people attracted to members of the same sex.
At about the same time a new, pejorative use was visible in some parts of the world. In the UK and the US, this connotation, among younger generations of speakers had a non-sexual derisive meaning equivalent to rubbish or stupid (as in "That's so gay.").
Starting in the 21st Century, the older meaning of "happy" has fallen out of use, and is pretty much unknown except among older adults.