I've been learning Italian recently just by myself on a very casual basis. One thing that I find confusing is which syllable to stress. I've read the rules - i.e. usually the penultimate syllable is stressed, unless there is an accent mark on the last syllable. However, there are many, many examples where the third-from-last syllable is stressed instead. So, for example, when I see a word like telefono, or illeggibile, how can I tell that it's the third-from-last syllable that is stressed, and not the penultimate one?
For a number of word endings the stress is predictable. For instance, all superlative forms in -issimo are “sdrucciole” (i.e., stressed on the third-from-last syllable): bellìssimo, velocìssimo and so on. The same holds for most moods and tenses of verbs, and suffixes, and other regular modifications of words. You can find many of them in the online Dizionario di Ortografia e Pronunzia, under “Suffissi”, “Desinenze grammaticali” and “Terminazioni con varianti di forma”.
As for single words themselves, short of knowing well their etymology (and often even then), there is no alternative to looking them up in a good dictionary. Italians themselves often have to do so (and Italians themselves often get a stress wrong).
As for your particular examples:
illeggibile falls within the “predictable” case: -abile, -ibile suffixes denote something that “can be done” (leggere = to read; leggere + -ibile = leggibile = readable; in your case the prefix in- negates this, yielding the meaning of “unreadable”) and they are always stressed on the third-from-last syllable;
telefono, on the contrary, like some modern formations from Latin and Greek roots, is a mess. Compare telèfono with telescòpio, or motoscàfo and piròscafo, for instance. You have to just look them up, unfortunately.
Jakub Marian (https://jakubmarian.com/stress-position-and-accents-in-italian/) provides the following suffixes to help with determining the stressed syllable.
-agine, -aggine, -igine, -iggine, -edine, -udine, -abile, -evole, -ibile, -ico, -aceo, -ognolo, -oide, -cefalo, -crate, -dromo, -fago, -filo, -fobo, -fono, -gamo, -geno, -gono, -grafo, -logo, -mane, -metro, -nomo, -stato, -tesi, -ttero, -fero, -fugo, -voro
If an Italian word ends in one of these suffixes, it is likely to be stressed on the antepenultimate syllable.
Other than that, and the grave accent stressing the last syllable of a word, you'll have to use a dictionary.