An old loan from Arabic مَسْجِد (masjid), possibly through Ta'izzi-Adeni (southern Yemeni) Arabic (noting retention of older *g). Compare Tagalog mansigit and Indonesian masjid.
masigit (Sundanese script ᮙᮞᮤᮌᮤᮒ᮪)