According to the theory of rhythm perception, the perception of rhythm involves the motor system just as much as the sensory system. It postulates that a ‘beat’ is actually perceived as a movement.
The theory then suggests that because a beat is perceived as a movement, the activation of a stereotyped behaviour such as tapping your foot in time with the beat is a natural extension of the way motor and sensory systems often work together to produce a percept.