This is a general rule, and a historical change. This question is accounted by historical development and dialectal difference.
Let's see some Classical Japanese conjugations and their Modern reflections:
Forms Classical Modern Eastern Modern Western
終止形 たのし (replaced by 連体形)
連体形 たのしき たのしい たのしい
連用形 たのしく たのしく たのしゅう
Classical adjectives had three distinct forms: 終止形 ("I am happy"), 連体形 ("happy man") and 連用形 ("play happily"), among which 終止形 was eventually replaced by 連体形, resulting in today's dictionary form that serves for both functions.
Meanwhile, there was a sound change that eliminated consonant //k// and //g// in the middle of word (lenition). In Western dialects (e.g. Kyoto or Osaka) this effect was active when the following consonant is //-i// and //-u//, while in Eastern dialects (e.g. Tokyo) it only happened when //-i//. As the result, たのしき became たのしい nation-wide, but たのしく only became たのしう in Western area, remaining unchanged in Eastern.
Next, there was another change that made diphthongs ended in //-u// to long vowels. Thus in Western dialects, verbs' 連用形 (i.e. adverbial form) have become:
- ありがたう arigatau → ありがとう arigatō
- たのしう tanosiu → たのしゅう tanosyū
- おもしろう omosirou → おもしろう omosirō
So, in Modern context, ありがたく and ありがとう are Eastern and Western form of the same conjugation. As Modern Standard Japanese is based on a Eastern dialect in Tokyo, we only need ありがたく in theory. Why the form ありがとう appears in Standard Japanese?
That's because some courtly language was imported from Kyoto, where the palace was located until Meiji. Forms end with -う are basically only occur in very limited occasion, namely before ございます, which is the highest variation of keigo. The common greeting words like ありがとう or おはよう are originally followed by ございます too, but come to be used independently for brevity.
The dialect atlas by NINJAL, No. 139. Distribution of adverbial form of an adjective. Generally, blue-green area retains the consonant //k//, orange area without //k//.