When is “Y” a vowel?
Why are 'w' and 'y' called semi-vowels in English?
Vowels are generally sounds where, as you pronounce them, part of that pronunciation does not involve deliberately constricting the vocal tract in a particular place. (In informal terms, you "let the air flow freely out of your mouth".) These sounds usually form the centres of syllables and can often be words in their own right.
Consonants are sounds where part of the very definition of the pronunciation of that sound involves constriction at some point(s) in the vocal tract. These sounds generally form the edges of syllables.
There are then a few sounds that are almost 'on the edge' between these two definitions: sounds that are essentially 'vowel-like consonants'. These might be described phonetically as 'vowels with a small amount of constriction' but which function as consonants in that they don't occupy the centres of syllables. You might think of them informally as "glides" between two vowel positions (but like other consonants, they can be geminated, whereas by "glide" people tend to envisage a rapid movement).
To a linguist, vowels, consonants and semi-vowels are strictly speaking classifications of sounds, not letters of the alphabet. But of course informally, people sometimes bastardise the terms "vowel" and "consonant" to refer to letters of the alphabet, so you might extend this to refer to 'vowel' letters when used to represent the sounds at the edges of syllables. But it is worth bearing in mind that there is no strict lingiustic definition of 'semi-vowel' to refer to letters of the alphabet bceause that's not how the term is used by specialists. (I also wonder if it's really that useful to call letters of the alphabet "consonants" or "vowels" other than for the purpose of playing Countdown.)
Vowels are defined both by how they are made in the mouth (no closure, just shape), and how they can function in syllables. Since [w] and [y] are like [i], [u], etc. in that they involve no closure, but just shape of the mouth parts, we might think of them as vowels.
However, when it comes to how [w] and [y] function in syllables, they are not much like vowels. Vowels can be what are called syllable nuclei: the 'loud, long' part of a syllable. Consonants, on the other hand, function syllable borders. [w] and [y] are syllable borders in words like 'yes' and 'was.'
So, the terms 'semi-vowel' and 'glide' are used for these two sounds.
The question, when is 'y' a vowel? Has to do with spelling, I think, as opposed to how the sound [y] functions in the English language. In the word 'syllable', the letter 'y' represents the SOUND [I] (to use the phonetic symbol for the sound). In the word 'happy', linguists write the final 'y' sound in various ways. Most of them indicate an 'off-glide' close to the [y] sound in 'yes', but they start as a vowel sound such as [i] (as in 'beat') or [I] (as in 'bit'). So the vowel written as 'y' might be phonetically represented as [Iy].