The word “gay” seems to have its origins around the 12th century in England, derived from the Old French word ‘gai’, which in turn was probably derived from a Germanic word, though that isn’t completely known. The word’s original meaning meant something to the effect of “joyful”, “carefree”, “full of mirth”, or “bright and showy”.
However, around the early parts of the 17th century, the word began to be associated with immorality. By the mid 17th century, according to an Oxford dictionary definition at the time, the meaning of the word had changed to mean “addicted to pleasures and dissipations. Often euphemistically: Of loose and immoral life”. This is an extension of one of the original meanings of “carefree”, meaning more or less uninhibited.