The real part of a complex exponential function can be used to represent an AC voltage or current. The impedance can then be expressed as a complex exponential. Impedance combinations. Phasor diagrams. The impedance of the individual circuit elements can then be expressed as pure real or imaginary numbers.

Simply so, why impedance is a complex number?

Impedance is a complex number because it conveys 2 pieces of “orthogonal” information : magnitude and phase. Complex numbers are a convenient way to represent these 2 pieces because it is a 2-D plane. From a circuit perspective, the phase component comes because of presence of capacitors and inductors.