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). The ultimate origin is disputed; perhaps from Frankish *gahi (related to Old High German wahi "pretty"), though not all etymologists accept this.
The 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," also late 14c. In the English of Yorkshire and Scotland formerly it could mean "moderately, rather, considerable" (1796; compare the 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.
The slang meaning "homosexual" (adj.) begins to appear in psychological writing in the 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.
"a (usually male) homosexual," by 1971, from gay (adj.). In Middle English it meant "excellent person, noble lady, gallant knight," also "something gay or bright; an ornament or badge" (c. 1400).
a Scottish variant of gay (compare gray/grey), used 18c.-19c. also with the Scottish sense of "considerable, pretty much, considerably."
"cheerfulness, mirth," 1630s, from French gaieté (Old French gaiete, 12c.), from gai "gay" (see gay). In the 1890s, in Britain, especially with reference to a London theater of that name, and the kind of musical shows and dancing girls it presented.
"worthless person" (especially a young hoodlum or petty criminal), 1917, probably from punk kid "criminal's apprentice," U.S. underworld slang attested by 1904 (with overtones of "catamite"). Ultimately from punk (adj.) "inferior, bad" (q.v.), or else from punk "prostitute, harlot, strumpet," attested by 1590s, of unknown origin. Related: Punkling. For the possible sense shift from "harlot" to "homosexual," compare the possibility in gay.
By 1923 used generally for "young boy, inexperienced person" (originally in show business, as in punk day, circus slang from 1930, "day when children are admitted free"). The verb meaning "to back out of" is by 1920.
The "young criminal" sense no doubt is the inspiration in punk rock — loud, fast, aggressive, and outrageous — which is attested by 1971 (in a Dave Marsh article in Creem, referring to Rudi "Question Mark" Martinez); widely popularized in 1976.
If you looked different, people tried to intimidate you all the time. It was the same kind of crap you had to put up with as a hippie, when people started growing long hair. Only now it was the guys with the long hair yelling at you. You think they would have learned something. I had this extreme parrot red hair and I got hassled so much I carried a sign that said "FUCK YOU ASSHOLE." I got so tired of yelling it, I would just hold up the sign. [Bobby Startup, Philadelphia punk DJ, Philadelphia Weekly, Oct. 10, 2001]
shortening of faggot (n.2) "male homosexual," by 1921. Fag hag "heterosexual woman who keeps company with gay men" attested by 1969.