It's actually not so
simple. Tapping the knee pulls on a tendon of the muscle that extends
the leg. The message that the muscle is stretched goes to the spinal
cord, where there is a direct connection to a motor neuron that
contracts the muscle. But there are also connections to other muscles,
which inhibit the contraction so that you don't react too hard.
(Being able to control muscle movements without jerking is very
important. A jerk, or spasm, makes movement inefficient.)