Everyone has heard this at least once in their childhood, if they lived in an English speaking country. There might be version for different language and culture, though I can’t confirm that. The myth is that the Druids used it to decide who to sacrifice and it was some kind of counting system in the Anglo-Saxon, Celtic or Welsh language. Thought the latter is not proven but the first one has been considered real for a longtime.
The first ever time this rhyme ever appeared was in 1855, but it dates back far long before that. At that time the words were different from the present ones, for example it was “Hanna,mana,mona, mike”. It follows the same trend, three words starting with m and one with another.