Understanding of Relays and associated circuitry
The defining characteristic of coils (or more precisely, inductance) is that they prevent the current from changing fast. When you rapidly close the transistor, the coil will increase the voltage across itself as much as it is necessary to ensure that the current continues flowing.

Without the diode, the voltage generated by the coil would be high enough to destroy the transistor. With the diode, only the voltage drop across the diode would be generated (0.7V to 1V usually) by the coil.