"Islamic place of worship and the ecclesiastical organization connected with it," 1717, earlier moseak (c. 1400), also mosquee (16c.), probably in part from French mosquée, from Italian moschea, earlier moscheta, from Spanish mesquita (modern mezquita), from Arabic masjid "temple, place of worship," from sajada "he worshipped" + prefix ma- denoting "place." Mangled in Middle English as muskey, moseache, etc.
<a href="https://www.etymonline.com/word/masjid">Etymology of masjid by etymonline</a>
Harper, D. (n.d.). Etymology of masjid. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/masjid