We came here to learn English.
We came here for learning English.
"For" in this context should have a noun as it's object: "for a thing".
We came here for the cupcakes.
We came here for a specific purpose.
"For" could be used with "learn":
We came here for the purpose of learning English.
Notice that "purpose" is clearly a noun. "for the purpose of learning" and "to learn" are basically synonymous here.
How about this sentence:
We came here for swimming.
Something's strange about that.
We came here to swim.
The next question, is why. What explains the rule? This is a conundrum, because as a native speaker I know what sounds right or wrong, without always being able to say the rules. It may be due to the fact that there's a difference between a noun and a thing. Even though "learning" is grammatically a noun, it's more of an action than an object.