An inductor discharges when connected to a capacitor due to the relationship between current and magnetic fields. When current flows through the inductor, it creates a magnetic field, storing energy as described by E = ½·L·i². Upon connecting to a capacitor, the inductor begins to transfer energy, charging the capacitor while the inductor current decreases. This process creates an oscillation of energy between the inductor and capacitor, described by harmonic motion equations. The interaction continues until the energy is fully exchanged, illustrating the dynamic behavior of inductors and capacitors in an electrical circuit.