There are several issues here.
/j/ and /w/ are phonologically consonant sounds in English
Yes, the semivowels /j/ and /w/ are classified as consonant sounds in English, even though phonetically they are like vowels. That’s just how English works. This applies most noticeably to the a/an rule: we say “a university” and “a one-time deal” and as far as I know, no modern English speaker would find *"an university" or *"an one-time deal" acceptable.
Pronunciations of “the”
The form /ði/ is used, no matter what the following sound is, when this word is emphasized. The most common context for this might be a contrast with another determiner like “a/an”.
In non-emphatic consonants, the situation is more complicated. However, the rule you were taught is correct. There are just other factors that can affect pronunciation. I’m taking the following information from “Constraints on definite article alternation in speech production: To “thee” or not to “thee”?” by M. Gareth Gaskell, Helen Cox, Katherine Foley, Helen Grieve, and Rachel O’Brien, which is specifically about British English speakers.
In non-emphatic contexts where the following sound is a consonant, the form /ðə/ is usually used. However, there are a few factors that increase the likelihood of using /ði/ before a consonant sound.
- second-syllable stress
- the glide /j/, even more so where it is spelled with the letter <u>
In non-emphatic contexts where the following sound is a vowel, the form /ði/ is usually used. However, there are a few factors that increase the likelihood of using /ðə/ before a vowel sound.
- first-syllable stress
- the vowel /i/ or /ɪ/ (the greater likelihood of using /ə/ before these than before other vowel sounds can be seen as a form of dissimilation: it's awkward to have two identical or similar sounds right next to each other)
Despite the existence of factors that increase the likelihood of using the “opposite” form, Gaskell et al. found that the vast majority of the 50 adults in their study closely followed the consonant-vowel rule. So for an English language learner, I would recommend learning to apply this rule, although it’s not a big deal if you use the “opposite” form: native speakers do also sometimes. Obvously native speakers don't have to try to follow this rule (most of them will automatically, but some might not), but this site is not for native speakers.
3
Related: Is pronouncing "The" as "Thee" still correct in titles?"
– Robusto – 2017-01-29T01:03:10.0601Why initial "u" is pronounce /ju:/ instead of /u:/ is an interesting question in itself. – chepner – 2017-01-29T16:43:48.640
1A lot of languages drop "the" entirely. You rarely hear a Russian say it when they speak in English, as in "Ukraine". And UK-English speakers drop it from both university and hospital. Just sayin' – SDsolar – 2017-01-30T01:00:37.280
You might also ask why owl and ouch are pronounced so similarly. Goes with the rhyme A,E,I,O,U, and sometimes Y and W in unbroken meter. – SDsolar – 2017-01-30T01:01:27.730
It's pronounced "yooniversity". It's a consonant sound. – Boann – 2017-01-30T14:13:06.153
@Boann yoo sounds like a vowel (u) to me. I think it's regional. I'd use thee, but I am Canadian and born to Brit ex-pats. Here in Texas, I hear it used both ways, thuh and thee. – WRX – 2017-01-30T15:08:35.363
@WillowRex "U" is a vowel letter because it makes a vowel sound ("uh"), but its name ("yoo") does not start with a vowel sound. Whereas, say, "F" is a consonant but its name happens to start with a vowel sound ("eff"), hence "an FBI agent", but "a UFC figther". This isn't difficult. – Boann – 2017-01-30T15:55:41.683
@Boann well I guess it is difficult to me because I did not understand your comment. That's fine. It's not necessary to explain yourself to me. – WRX – 2017-01-30T15:57:51.167