late 14c., "full of joy, merry; light-hearted, carefree;" also "wanton, lewd, lascivious" (late 12c. as a surname, Philippus de Gay), from Old French gai "joyful, happy; pleasant, agreeably charming; forward, pert; light-colored" (12c.; compare Old Spanish gayo, Portuguese gaio, Italian gajo, probably French loan-words). Ultimate origin disputed; perhaps from Frankish *gahi (related to Old High German wahi "pretty"), though not all etymologists accept this.
Meaning "stately and beautiful; splendid and showily dressed" is from early 14c. Of things, "sumptuous, showy, rich, ornate," mid-14c. of colors, etc., "shining, glittering, gleaming, bright, vivid," late 14c.; of persons, "dressed up, decked out in finery," late 14c.
In the English of Yorkshire and Scotland formerly it could mean "moderately, rather, considerable" (1796; compare sense development in pretty (adj.)).
The word gay by the 1890s had an overall tinge of promiscuity -- a gay house was a brothel. The suggestion of immorality in the word can be traced back at least to the 1630s, if not to Chaucer:
But in oure bed he was so fressh and gay
Whan that he wolde han my bele chose.
Slang meaning "homosexual" (adj.) begins to appear in psychological writing late 1940s, evidently picked up from gay slang and not always easily distinguished from the older sense:
After discharge A.Z. lived for some time at home. He was not happy at the farm and went to a Western city where he associated with a homosexual crowd, being "gay," and wearing female clothes and makeup. He always wished others would make advances to him. [Rorschach Research Exchange and Journal of Projective Techniques, 1947, p.240]
The association with (male) homosexuality likely got a boost from the term gay cat, used as far back as 1893 in American English for "young hobo," one who is new on the road, also one who sometimes does jobs.
"A Gay Cat," said he, "is a loafing laborer, who works maybe a week, gets his wages and vagabonds about hunting for another 'pick and shovel' job. Do you want to know where they got their monica (nickname) 'Gay Cat'? See, Kid, cats sneak about and scratch immediately after chumming with you and then get gay (fresh). That's why we call them 'Gay Cats'." [Leon Ray Livingston ("America's Most Celebrated Tramp"), "Life and Adventures of A-no. 1," 1910]
Quoting a tramp named Frenchy, who might not have known the origin. Gay cats were severely and cruelly abused by "real" tramps and bums, who considered them "an inferior order of beings who begs of and otherwise preys upon the bum -- as it were a jackal following up the king of beasts" [Prof. John J. McCook, "Tramps," in "The Public Treatment of Pauperism," 1893], but some accounts report certain older tramps would dominate a gay cat and employ him as a sort of slave. In "Sociology and Social Research" (1932-33) a paragraph on the "gay cat" phenomenon notes, "Homosexual practices are more common than rare in this group," and gey cat "homosexual boy" is attested in Noel Erskine's 1933 dictionary of "Underworld & Prison Slang" (gey is a Scottish variant of gay).
The "Dictionary of American Slang" reports that gay (adj.) was used by homosexuals, among themselves, in this sense at least since 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, but the word evidently was not popularly felt in this sense by wider society until the 1950s at the earliest.
"Gay" (or "gai") is now widely used in French, Dutch, Danish, Japanese, Swedish, and Catalan with the same sense as the English. It is coming into use in Germany and among the English-speaking upper classes of many cosmopolitan areas in other countries. [John Boswell, "Christianity, Social Tolerance, and Homosexuality," 1980]
As a teen slang word meaning "bad, inferior, undesirable," without reference to sexuality, from 2000.