Just as a light bulb can be made dimmer and brighter by changing the voltage (the number of batteries), so the speed of a motor can also be changed.
However, the rule is always to match the motor with the batteries. Too few batteries and the motor will run slow, too many and it will run fast for a while and then burn out.