One answer to this may be found in a recent theory of rhythm perception. The theory suggests that the perception of rhythm involves the motor system just as much as the sensory system. The theory then goes on to suggest 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. Now I do it even when I'm not the one performing.
Some habits are hard to break.