Could be muscle spasm in the masseter muscle or others around the joint.
The tight muscles can pull at the joint and put it a bit out of alignment as well.
So the pain itself can feel like it's in the joint, difficult to open mouth, painful to eat etc.
If you push around those muscles, you could find 'knots' even over the joint itself.
Or if not the muscle, could be an infection.