That outcome of <y> is specific to English, and as Y – Wikipedia says, it is through the influence of the obsolete English letter yogh, which was conflated with <y>:
The letter yogh (Ȝ ȝ; Middle English: yoȝ) was used in Middle English and Older Scots, representing y (/j/) and various velar phonemes. It was derived from the Old English form of the letter g. … It stood for /ɡ/ and its various allophones—including [ɡ] and the voiced velar fricative [ɣ]—as well as the phoneme /j/ (⟨y⟩ in modern English orthography).
The velar instances of yogh were replaced by <gh>; the palatal instances were replaced by the arguably similar-looking <y>.
Answered 2017-05-31 · Upvoted by , MA in Linguistics from BYU, 8 years working in research for language pedagogy.