Demonstration on the flyback voltage from an inductor and how connecting a diode across it will help. Press and hold the switch and watch the voltage spikes.
One of the diode is connected in the right way (reverse bias), and one in the wrong way (forward bias). You can try out the circuits and find out why the diode should be connected in reverse bias to the power.
The 100mR resistor represents the resistance of the inductor.