The Hunmin Jeongeum Haerye, the treatise introducing the principles behind the Korean alphabet attributed to King Sejong in 1446, explains that this glyph was derived from the outline of the mouth because /m/ is a "labial sound" (唇音). Note that it is nearly identical in shape to 口(kǒu), the Chinese logogram for "mouth". According to Sejong, the letters ㅂ (b, “b”) and ㅍ (p, “p”) were created by adding strokes to ㅁ, because all three are bilabial sounds.
Gari Ledyard proposes that Sejong derived ㅁ from the lower part of ㅂ, derived from the 'Phags-pa letterꡎ(p). Ledyard gives evidence that Sejong adopted 'Phags-pa for the basic glyph forms, although the final shapes of the letters may indeed have been influenced by those of the speech organs (Ledyard 1997).