How it works
A DC motor converts electrical energy into mechanical rotation. Inside the motor, current flows through coils of wire, generating a magnetic field that pushes against stationary magnets mounted in the motor housing, forcing the central shaft to spin.
Because a motor relies on coils of wire, it is a highly inductive load. When power is removed, the collapsing magnetic field generates a large reverse voltage spike (flyback voltage). To prevent this spike from destroying sensitive driving transistors, a flyback diode must be placed in reverse-parallel across the motor terminals.
Motors also act as generators. As the motor spins, it generates a "back EMF" (voltage) that opposes the supply voltage. If you physically stall the motor, the back EMF drops to zero, and the motor draws a massive "stall current" limited only by the low resistance of its copper windings.