Consider "the key to the door" for example. "To the door" is an adjective phrase modifying "key".
Similarly in "the key to learning a language", "to learning a language" is an adjective phrase.
It consists of the preposition "to" and the gerund phrase "learning a language" which serves as the object. There is no infinitive involved.
If this does not help, study more about gerunds and gerund phrases.
- For Teachers