So you know it has something to do with transients, right? Let's make a thought experiment from this. Say that you have an inductor, it was connected to a power source for a very long time. Say the power source delivers a 1A current. Then because of its properties (an inductor is little more than a short circuit when it comes to steady state) the voltage across it will be 0V.
Now imagine that you remove the power source and change it for a 0 ohm resistor. What would happen? Right after removing source, the current through the inductor is still 1A and is now forced through the 0 ohm resistor, resulting in a V = I × R = 1A × 0Ω = 0V. So far so good, nothing changed.
Now imagine that you changed the resistor for a 10Ω part, what would happen right after removing the power source? The inductor will now force its current through a 10Ω resistor: V = I × R = 1A × 10Ω = 10V.
Now it is easy to imagine what happens if that resistor gets larger and larger: 100Ω results in 100V, 1kΩ in 1kV, 1MΩ in 1MV, and so on. A resistance nearing infinity will imply an (theoretical) infinite voltage and that is where physics really gets interesting.
Of course there is only a finite amount of energy stored in the inductor and therefore the high voltage will not exist for very long, only a brief moment after removing the power source.
A similar thought experiment can be done with a capacitor. A capacitor is little more than two plates that do not touch, so a very high resistance and in steady state it is charged with a voltage and no current can flow. Similar to the inductor we can again connect parallel resistor, but now you start with a very high value and work back to 0 for a short circuit and calculate the respective current right at the moment after the voltage source was removed.