“Sweet Molly Malone” is an Irish song first published in 1876 (in Boston, not Ireland) about a young woman who was a fishmonger in Dublin. She might have been a real person, although nobody really knows. But what she sold was real: “cockles and mussels, alive, alive-o,” as the song goes.
Cockles are shellfish, like mussels or clams, and common around Atlantic and Mediterranean coasts. There are similar words for the same mollusk in French, Italian, and Greek. And the word “cockle” shows up in some other venues too. Before it was used for seafood, a “cockle” was (and still is) the name of a plant. The plant doesn’t seem to have anything to do with mollusks at all; it grows around cornfields, nowhere near the beach. Its flowers are reddish-purple though, and some of the mollusk-type cockles have dark shells (like mussels), so that might be a connection.
An even more distant connection, though, is in the phrase “warm the cockles of your heart.” The phrase has been around since at least the mid-1600s: “This Contrivance of his did inwardly..rejoyce the Cockles of his heart.” Decades of cardiological research has, of course, completely failed to identify anything like plants or shellfish being connected to hearts. However, in medieval Latin, the heart’s ventricles were called “cochleae cordis.” In the time-honored tradition of advancing the language on the basis of mishearing something, “cochleae” might have been mistaken as “cockles” by people who didn’t know medieval Latin (which, to be honest, was practically everybody).
But there is a shellfish connection there, possibly completely by coincidence: “cochlea” is the Latin word for “snail.” It was evidently used in “cochleae cordis” because of the shape of the ventricles. In more modern times, it’s been used in relation to a part of the inner ear that’s arranged as a spiral, just like a snail shell. In any case, we came pretty close to having a phrase like “warm the snails of your heart” rather than the cockles. If nothing else we got lucky that one time.