Cellphone type power button

The power to the motor is not directly controlled by the button. Only a tiny signal comes from the button, telling the chip if the button is pressed or not. The logic in the program running on the chip controls the motor, that logic changes in response to the signal from the button.

As mentioned above, the chip cannot control the motor directly. A driver circuit/module is required between the atmega chip and the motor because the motor will require more power than the atmega's pins can provide.