I went down a bit of a rabbit hole trying to work out where the different sounds of the "y" in English came from. I quickly established that the semi-vowel was originally written with a yogh, and later came to be written with a "y" likely from French influence. This just kicks the can down the road, though — how did French came to write yod as "y"?
On the surface it seems fairly obvious since "y" already represented /i/ and so since "i" in the early days also represented both /i/ and /j/, the leap was fairly obvious. But I wonder if people would have suddenly assigned a new meaning to a letter that previously never held that meaning — I mean, we are very familiar with English with the different pronunciations of "c" for instance, but if someone tried to spell an /s/ sound with a "k" I'd think they were mad. So extending a sound represented by one letter to a different letter that represents a different shared sound as the first letter doesn't necessarily make sense to me as an obvious explanation that doesn't need elaborating upon — I mean, it might still be true, but I wouldn't like to just assume it without evidence.
I was looking at French sound changes and I noticed that the modern semi-vowel /j/ seems to have a number of sources — one from unpalatisation of a consonant, and one from lenition of stops. But I was wondering if maybe the different sources of this sound could have motivated initially the use of a different symbol, perhaps "y", to represent one? I don't know when these sound changes happened relative to the establishment of "y" in the orthography of French to mean a semivowel, or indeed enough about French to really spot if there could be a pattern here (though of course even if there was initially a pattern it could easily have been eroded later on).
So have there been any studies on exactly how "y" might have gained this new meaning of the semivowel?