Why is Y sometimes a vowel?
A, E, I, O, U, and sometimes Y. You might have learned it as a chant, a song, or a simple declaration, but this is how you learned the vowels of English. You may have wondered, why is Y so unsure of itself? Can't we just decide what it is? Why is Y a "sometimes" vowel?
Because writing is not the same thing as speech. While we casually refer to letters, which are written symbols, as vowels or consonants, the concepts of vowel and consonant properly belong to the domain of speech. In general terms, a consonant is a speech sound formed by some kind of constriction or impeding of air flow through the vocal tract, and a vowel lets the air flow freely through. The letter Y can stand for either of these types of sounds. In "yes," Y is representing a consonant, and in "gym" it is representing a vowel.
In fact, due to the imperfect match between writing and speech, there are other "sometimes" vowels: W is a consonant in "we" and part of a diphthong vowel in "now." H is a consonant in "hat" but what is it in "ah"? It's part of the representation of a different vowel sound; compare it with "a." If we look hard enough, we can even find examples of "sometimes" consonants. What sound does the O represent in "one"? What sound does the U represent in "united"? They are consonant+vowel combinations 'wuh' and 'yu.'
A, E, I, O, U and sometimes Y is not a bad rule of thumb. Most of the time a spoken vowel will be represented by one of those written forms. And Y swings between vowel and consonant more than other swing letters. But it's worth remembering that letters are not speech sounds. They are lines on a page, pixels on a screen that nudge us, quite imperfectly, toward the sounds of the things we say.