I wonder if they learn some of it still in the womb. After all, most mothers say they can feel "kicking" sometimes. That might actually be the fetus learning how to extend its limbs
The movement is frequent enough that a measure of health for the baby starting about 3/4 of the way through the pregnancy is to have the mother count movements until she reaches 10, which should take between 30 minutes and 2 hours.