The Oxford English Dictionary has a long article for Gay in its many senses, and we can assume it was a very carefully curated article. My answer here is intended to give a plain answer as documented by the OED, which is conservative in its outlook. I'm sure a LGBQT+ sociolinguist would be able to give you a much more nuanced answer, as the adoption of the new meaning would not be uniform across different social or geographical groups.
https://www.oed.com/view/Entry/77207 (Sadly, the OED requires a login, but you can use most UK library cards, without a fee).
The OED says the change took place after the 1960s. For a foreign learner of English, that's probably enough. (Though if you're interested in youth slang, see also the "lame" meaning below. Certainly commonly heard in London, I don't know if it's common elsewhere.)
The OED is about written English: "The OED is based on quotation evidence: real examples of words in use, throughout the written record."
1. Gay in the sense of "Bright or lively-looking, esp. in colour; brilliant, showy." goes from c1255 to 1922 (PG Wodehouse) with two West Indian examples later (1974, 1990). There are about half a dozen slightly different meanings (which are mostly variants of "lively", "hedonistic", "beautiful", "showy" etc) which mostly end in the 1930s. A few ("happy and gay", "with gay abandon") are listed with contemporary quotations, or marked as regional.
2. Most of the homosexual meanings ("gay pride", "gay liberation", "gay icon") have first quotations from the 1960s and 70s. As an adjective, "Gay" in this sense is marked as "Originally U.S. slang" first quoted from 1922, as a noun in 1953.
3. A newer meaning "Foolish, stupid, socially inappropriate or disapproved of; ‘lame’. derogatory (frequently considered offensive)" is marked from 1978.
The OED has a long note:
The relationship between the various subsenses of sense A. 4 [lewd/promiscuous/uninhibited/hedonistic/homosexual] is difficult to establish from the available evidence. It seems most likely that the ‘homosexual’ sense A. 4d was primarily a development of sense A. 4b, [dedicated to social pleasures; dissolute, promiscuous; frivolous, hedonistic] especially of its connotations of hedonism and lack of inhibition, while the ‘prostitution’ sense A. 4c [Esp. of a woman: living by prostitution] was a separate development from sense A. 4b. In quot. 1889 at sense A. 4c gay is used by a male prostitute of people engaged in prostitution, but not specifically in the sense ‘homosexual’ (compare quot. 1890 at sense A. 4c, quoting the same source). Some examples of gay cat n. at Compounds 2a imply a relationship with an older tramp involving sexual favours (compare punk n.1 2b, gunsel n. 1), but this cannot be taken as earlier evidence that gay itself was being used in the sense ‘homosexual’. However, early discomfiture among some homosexuals about the adoption of gay to describe themselves was based on the word's associations both with prostitution (sense A. 4c) and with frivolity and promiscuousness (sense A. 4b).
By the 1960s gay in the sense ‘homosexual’ (sense A. 4d) had become established as the preferred term of self-reference for many homosexual men. The subsequent more general currency of this sense has led some commentators to claim that this is now the dominant sense of the word, and that gay in its earlier meanings of ‘carefree’ or ‘bright and showy’ cannot readily be used today without at least a sense of double entendre.