Why are "nation" and "national" pronounced differently?
Solution 1:
There isn't a pattern or rule; nation/national is unique. Of all -ational words, only national and rational are pronounced with /ˈæʃən/ (rhymes with "ashen"). Ration/rational, however, is usually consistently /'ræʃən/ and /'ræʃənl/ (or /ˈreɪʃən/ and /ˈreɪʃənl/, though sometimes, as Peter Shor points out, /ˈreɪʃən/ is paired with /'ræʃənl/, using the same respective pronunciations as nation/national), even though the two terms are not closely related in meaning. National is therefore an oddball, being pronounced /ˈnæʃənl/ when nation is (as normal -ation words are) pronounced /ˈneɪʃən/.
I don't think anyone knows exactly why national isn't pronounced /ˈneɪʃənl/ like all the other -ational words.
Solution 2:
I would bet against the existence of any productive process in any form of modern English that accounts for the alternation between the vowel in the first syllables of "nation" and "national", though it seems Chomsky & Halle would disagree with me. In any case, I believe this is probably just the result of a process of trisyllabic laxing that occurred in earlier stages of English.