Although it exists in many languages in a variety of forms, its roots are elusive. "I have no theory of its origin," said Anatoly Liberman, a linguist at the University of Minnesota and an expert on word origins. "Possibly it could have spread from French to English… but you cannot trace it in any way as far as its distant history is concerned, because the word is so natural that it may have arisen at any time."All of this makes a sort of just-so-story type of explanation. However, like many things about language and society, this isn't as universal as we might think. I remember in Scotland, that the use of hmm was heard (by me) less often than emmmm; in my high school years, the more common thing was ummm. In Japanese, there's the ehhhh (and sometimes ehhh~tohhhh...) and well as the nnnn; not so much with the hmm.
Hmm is technically categorized as an "interjection," along with the likes of um, huh, ouch and wow. It's also "sound symbolic," along with onomatopoeia words like plop, ping or oink — "except that it's symbolic of, really, nothing," Liberman told Life's Little Mysteries.
"The first h-sound is simply a substitute for breath, and the second m-sound, since the mouth is closed, is symbolic of the fact that we're not quite sure what to say," he said. The pause filler indicates that we're temporarily speechless, but still engaged. The variety of tones we may take add subtle meaning to the interlude.
This sort of thing makes me question the universality of explanations like the above. However, with American English becoming the major spoken form of English in the world, hmm could well become the dominant (or more common) expressive form that indicates pondering.
However, when thinking of things that make you go hmmm, there is, of course, always this: