There is a joint which joins the upper and lower jaw and controls its movements like in knees we all have.
Inflammation due to trauma of that joint leads to clicking and pain.But you might also have an infected and decayed tooth on the same side which is adding to the discomfort.
Next Steps
Get an OPG (Full mouth X-ray done) for better view of joints and teeth together.
Health Tips
Till then keep your hanky on hot bottle, once it gets hot keep it on the face over the joint area for 5 mins..Do this Hot fermentation 3 times a day..