A lively telling of some of the history of the word that never did just mean “happy”.
The word “gay” to mean “a male-designated person boning a male-designated person” or “a female-designated person boning a female-designated person” emerges in the late 19th century. It's hard to tell exactly when, for a variety of very interesting reasons; prime among them is that the word “gay” has a bunch of related meanings that smear all over each other. Rockin through the Oxford English Dictionary, we find that “gay” in the 19th century, while it meant a lot of things, meant “prostitute” half the time. So a “gay girl” was a prostitute, and a “gay house” was a brothel. Over time, the word's meaning starts to soften, so as the word evolves it goes from meaning “being a whore” to “being sexually forward” to “being silly and a bit impertinent,” though it never quite loses the sexually-immoral connotation that it has originally. And it's not like words or language evolve linearly, the same way and at the same rate in all places: all these meanings come to overlap and interact.
So, as an example, in the early 20th century, some meanings for “gay” included: dissipated, forward, whorish, impertinent, frivolous, cheerful, immoral, and homosexual (that's not even all of them). People have a mistaken idea that “gay” used to mean “happy,” but that leaves out the over-the-top connotations of immoral, sexual, or irresponsible happiness that the word carried, even when used to mean “cheerful” or “happy.” When you read a sentence in an old book that's like “we had quite a gay time at the picnic,” they do mean that they had a cheerful happy time, but there are other connotations to it — that they were carefree, childish, irresponsible, irreverent, inappropriate, silly, etc.
Do you start to see how the word becomes a marker for that thing we do, that thing where designated-X-at-birth and designated-X-at-birth have makeouts? It doesn't become a marker of sexual deviance; it is already a marker of sexual deviance.