From 麻雀 (máquè, “sparrow”), with a diminutive suffix /ŋ̍/ (syllabic velar nasal) from some Wu dialect (compare Modern Wenzhou dialect /ŋ̍/). This suffix then fused with the preceding syllable, and was conserved in the form of a nasal rime /-ŋ/. As an example compare Modern Shanghai dialect 雀 (què) (old pron.: /t͡ɕiᴀʔ⁵⁵/) + /-ŋ̍/ → 將/将 (jiāng)/t͡ɕiã⁵³/.
The game of mahjong was called "馬吊/马吊" during the Ming and Qing dynasties, where the second syllable presumably represented a Wu dialectal pronunciation of 鳥/鸟 (niǎo) ("bird", see there for more).