In the following sentence,
why don't we use the infinitive -
What is the logic behind
Я Учу игре на гитаре.
"Я учу играть на гитаре" is grammatical, but sounds a bit awkward to me. The sentence feels like it is missing an object: "Я учу
его играть на гитаре" - "I am teaching him to play the guitar" sounds better.
So I would use the dative when saying that I teach how to play the guitar in general, and the infinitive when saying that I am teaching somebody how to play the guitar.
Come to think of it, if you use
преподавать, which is the other word for "teach", then it may sound better, and you can use the nominative case:
Я преподаю игру на гитаре.
Я преподаю вождение машины.
The logic of choice between verb compliment VS noun compliment is two-fold.
First, a choice between a noun and a verb (in a language where such a choice is possible) depends on a speaker's modal attitude towards an action described by a noun or a verb.
When a speaker regards the action as something pleasant or likable, or that what (s)he would like to be continued, (s)he is most probably to use a verb (this doesn't always work as a rule for languages where a choice of a verbal or a nominal form is grammatically mandatory).
When a speaker has and idea of the action described as of neutral or less pleasant or likable, (s)he is most likely to use a noun (also comprising adjectives in its broader sense).
Second, in Russian language the logic is based on Fenno-Ugric substrate. Both
Both Учу(сь) игре на гитаре and Учу(сь) играть на гитаре are equally grammatical. The difference is a) like in the first example and b) specific.
In Russian, nominal and verbal complements in this structure (I am not sure if there are other examples of it apart from those with учить) are usually mutually interchangeable:
Учу резьбе по дереву. => Учу (вы)резать по дереву.
Учу ковке металла. => Учу ковать металл.
Учу французкому. => Учу говорить по-французски.
Sometimes, however, the forms are not interchangeable. This usually happends when a nominal compliment (also comprising adjectives in its broader sense) takes a predicative form, or that of an adjective.
Учу быть собой.
Учу хорошему / плохому / вредному / полезному.