I just came across the words and then I looked them both up in the dictionary app, which shows the word "mobile" pronounces as /'məʊbaɪl/, whereas the other word-"automobile", which ends with the same spelt "mobile" pronounces as /'ɔːtəməbiːl/? I'm not sure if this "mobile" word pronounces differently as shown in the app or they actually pronounce the same?
Because mobile entered English in the 15th century and underwent the Great Vowel Shift (GVS). The GVS was a series of changes in the pronunciation of English vowels that took place between 1400 and 1700 [Wikipedia]. It must have been pronounced with /iː/ and the GVS changed the vowel /iː/ to /aɪ/ (also see bite, which was pronounced the same as beat before the GVS).
Automobile on the other hand entered English after the GVS and preserved its original vowel.