First, it should bear emphatically pointing out that "verb + こと" has little to do with expressing what your hobbies or habits are. Sure, you may happen to use it when telling your new friend that you often listen to music or like learning languages, but you are only using it in order to meet a grammatical requirement. What こと does, specifically, is to turn a verb phrase into a noun phrase (or "nominal", hence it's nickname: "nominalizer"). With that in mind, let's look at the example sentences one by one.
What we have here is a copular sentence, in which 私のしゅみ is the subject (marked with "は", meaning it's also a topic), "音楽を聞くこと" is the predicative expression and です is the copula. An equivalent sentence in English would be "My hobby is listening to music." You have to turn the verb phrase 音楽を聞く into the noun phrase 音楽を聞くこと, because a verb phrase cannot be the predicative expression in a copular sentence. 私のしゅみは音楽を聞くです。 is no more grammatical than "My hobby is listen to music." is.
Unlike the sentence above, there is no copula in this one. It is made up of an omitted (presumably) first-person subject (私) and a predicate with the non-copular verb 聞く (here in the polite form 聞きます). An English equivalent would be: "I often listen to J-pop on the train." There is no こと because there is no copula and therefore no need (in fact, it would be ungrammatical, or at least change the meaning of the sentence) to turn the verb phrase into a noun phrase.
So the copula です is back with this sentence. But we don't see こと. Why? Nannde? Well, that's because we don't have any verb phrase to nominalize to begin with! 外国語のべんきょう, you see, is already a noun phrase. (The noun べんきょう is a verbal noun that you can turn into a verb by attaching する, so that you get べんきょうする 'study (verb)', which then can be turned back into a noun (phrase) by attaching こと to it, resulting in べんきょうすること 'studying'.) An English version would be "My hobby is study of foreign languages." or perhaps bit more naturally, "My hobby is studying foreign languages."
So there you have it. That's broadly how each sentence works. You might have misunderstood your teacher when she explained the use of こと to you.