Why is PWM used to control DC motor speed instead of using a variable resistance?
Power efficiency
The induction of the motor will cause the current to average. At the same time the transistors in PWM mode have very low impedance and therefore a low voltage drop and low power dissipation. In case of a series resistor a lot of power is dissipated in the series resistor.

Speed control behavior
With PWM the motor will 'see' a very low power supply impedance, even though the power supply is constantly switching between high and low voltages. The result is that the motor has a much higher torque. With a series resistance the motor will experience a very weak power supply and it will be easy to stall the rotor.

Control circuit
For a control electronics (eg. a microcontroller) it is very easy to switch on/off transistors. Outputting an analog voltage or controlling a series resistor requires much more expensive circuitry and in turn will cause more power dissipation.