It's not a real word. It's just a kind of joke or convention. On stage and in the movies, actors playing evil villains laugh in a wildly exaggerated, mocking way. These are attempts to represent the sound of the laugh phonetically. There isn't really any correct spelling.
Personally, I happen to spell this as "Bwa-ha-ha!" but "Mwa-ha-ha!" is possible. The evil villain takes in a big breath of air in order to make a loud laugh. As his lips open, it makes a sound like the consonant "b" or "m." "U" and "w" are very similar, so "Mua-ha-ha" is possible. "Me-ha-ha" seems wrong to me, but someone might have used it. I separate the syllables with hyphens, partly because I think of the syllables as being widely separated, but they don't have to be.
The only valid general rule in English is "check a dictionary." In this case, none of these are in dictionaries. They aren't real words. Spell them however you have seen them spelled.
Other kinds of laughs are sometimes shown by spellings like "tee-hee" (for a small-half-suppressed giggle), "ho ho," "ha ha," and so on. Spelling, punctuation, and numbers of repetitions vary. "Ho ho ho!" "Hah hah!" "Tee hee hee," and so on.