Huh, today I learned that that is a neurological test.
I’m not a doctor, but I was always under the impression that when they do that they’re whacking on the tendon directly and the leg-jerk reaction is just… well, physics. The tendon is manually flexed and the leg should jerk in response and I always assumed this was just testing to make sure your knees are in good shape. But according to Britannica.com where my brief searching led me,
Exaggeration or absence of the reaction suggests that there may be damage to the central nervous system. The knee jerk can also be helpful in recognizing thyroid disease.
The Greeks had a bit of a story about that…