In an inductor, the current lags behind the voltage due to the energy being proportional to the square of the current, requiring work to change the current gradually. Conversely, in a capacitor, the current leads the voltage because its stored energy is proportional to the square of the voltage, allowing for abrupt changes in current while voltage changes gradually. The relationship can be mathematically expressed through differential equations, illustrating the phase difference between current and voltage. Additionally, real-world inductors and capacitors exhibit some capacitance and inductance, respectively, which affects their behavior. Understanding these principles is essential for analyzing AC circuits and their dynamics.