The jaw functions involve swallowing, eating/chewing, yawning, talking, etc and it involves a coordinated dynamics between different jaw and neck
muscles. These muscles are always active as they are involved in airway. Jaw spasms can occur due to stress; emotional and physical. We define teeth grinding or clenching,
postures and physical trauma as physical stress. Jaw spasms are often self limiting (soft foods for 4-5 days, over-the-counter pain killers etc).
Jaw muscles function as a unit rather than in isolation; it is not uncommon to have spasm of different jaw muscles at different time. The images below from anatomy
textbooks (Cunningham's) show the masseter and temporalis muscles which are the main jaw closing muscles.