In a resistor current flow directly causes a voltage drop so the voltage and current vary together with no lag: eg. if there is a step function of current there is a step function of voltage with no delay between the steps.
In a capacitor being supplied with a current, the current supplies the capacitor with a flow of electrons which it accumulates (integrates as a function of time) and the voltage across the capacitor is a function of its accumulated charge, or total charge.
eg. if there is a step function of current there is a linear ramp function of voltage instead of a step function.
It is this integration, or accumulation, as a function of time that causes the phase difference between the voltages across the resistor and the capacitor. eg. if the current into the capacitor is a sine wave, the voltage on the capacitor will be a cosine wave--the integral of the sine wave. Hence the pi/2 lagging phase difference.
Similarly for an inductor except the integral becomes a derivative and the phase difference becomes leading.