Children give meaning to the words from the knowledge accumulated in their universe. As a child,, I found easily, at least I thought I had, the etymology of learning by heart. Easy: because we love we learn, the heart being, had they told me, the core of emotions. The most exact etymology of this idiomatic expression, however, comes from the time when it was believed that the heart was not only the seat of emotions but also of intelligence, hence the term, which has not evolved with the development of scientific knowledge now locating the seat of intelligence in the brain. I have a special affection for this expression, which I continue to associate with the love of knowledge.
(For a complete etymology of the word heart, click the following link