(Note: this question is significantly more complicated than it sounds -- or than I expected when I encountered it. I present below perhaps more analysis than I need to, but I think it's all relevant.)
They are quite different constructions, although (especially in the context of language learning), these two are effectively equivalent. Most English constructions that resemble one another have some points of overlap, even if they aren't always (or even usually) synonymous.
(1) is an infinitive Object Complement with Equi, governed by the matrix verb learn. That means that the direct object of the verb learn in (1) is an entire clause.
Let's use a real example instead of variables:
- He learned to put the car in the garage.
The clausal object of learn here is (for him) to put the car in the garage.
Note, first, that the subject of the verb put in the subordinate clause is the same as the subject of the verb learn in the main clause: for him (which consists of the infinitive complementizer for and the subject him) has been deleted, under coreference with the matrix clause subject. That's what Equi means.
Second, note that this is not necessarily the same as the equivalent example of (2)
- He learned how to put the car in the garage.
They can be synonymous, but the first one can also mean that he learned that he should put it in the garage, or he learned when he should put it in the garage, or why, etc. The second one refers specifically, and only, to learning manner and means (i.e, how).
In the case of language learning, there's another wrinkle -- in English, learn
language means learn how to speak
language, and thus it's almost inevitable that learn to speak
language normally means the same thing.
But it's possible, in context, to interpret it differently:
- He learned to speak French whenever Madame was in the room.
Finally, there's the question of what the object construction is in (2). This is a rather peculiar construction, an infinitive embedded question. Embedded questions are one of the standard varieties of complement in English, and they always start with a Wh-word. Ask is a verb that can govern an embedded question complement, and so is learn:
- Bill asked me when/why/how/whether Mary studied German.
- Bill learned when/why/how/whether Mary studied German.
Note the possibility of the Wh-word whether here. This is diagnostic for embedded question constructions; whether cannot be used as a relative or free interrogative pronoun. It's the Wh-word that one puts before a Yes/No question when it's embedded, and that's its only use.
(2), however, is an infinitive, not a tensed question. Infinitives are always reductions from some type of clause, but it's sometimes difficult to see what kind. There is also such a thing as a relative infinitive clause, for instance, which is a relative clause that's been modified to make it an infinitive:
- the man that __ should deal with this ~ the man __ to deal with this (subject)
- the man that one should talk to __ about this ~ the man to talk to __ about this (object)
Relative infinitives normally don't allow relative pronouns; the following are ungrammatical:
- *the man who to deal with this
- *the man whom to talk to about this
unless the relative pronoun is Pied-Piped with a preposition; then the pronoun is obligatory:
- the man with whom to talk about this
So the existence of a Wh-word at the beginning of how to
Verb means this can't be a relative infinitive, and the grammaticality of whether identifies it as an embedded question.
The subject of how to
Verb, however, while it can be identical to the subject of its matrix verb (learn in (2)), can just as easily be indefinite -- i.e, learn how one can/should/must
Verb. Relative and embedded question infinitive constructions usually have a modal sense, whence the modal auxiliaries here.