Where is the problem?
If the capacitor is charged from \$0V\$ (inital voltage) to \$5V\$ via \$100kΩ\$ resistor with the time constant \$T = RC = 0.3s \$.
,immediately after we connect the supply voltage a current will start to flow. And becouse all this voltage from the power supply appears across the resistor (empty capacitor \$V_C = 0V\$ and KVL \$V_{IN} = V_R + V_C\$) this inital current is equal to \$I = \frac{5V}{100kΩ} = 50 \mu A \$.
This is why we can say that the empty capacitor act just like a short circuit.
As the capacitor begins to charge, the voltage across the capacitor begins to increase. At the same time, the current flow begins to decrease. Why? Because the voltage across the capacitor begins to increase. And the voltage across resistor must decrease by the same amount (KVL in action). This is why charging current (I = (Vin-Vcap)/R) begins to decrease as the voltage across the capacitor rises.
So, after \$0.5s\$ the capacitor voltage will reach this value:
$$V_C = V_{IN}(1 - e^{\frac{-t}{RC}}) = 5V(1 - e^{\frac{-0.5s}{0.3s}})= 4.05562V $$
$$I_{(0.5s)} = \frac{5V - 4.05562V}{100kΩ} = 9.4 \mu A$$
At this time the \$V_{IN}\$ "switches" to \$0V\$ and the capacitor will start a discharge process. Now the capacitor "act" just like a voltage source. And we connect this voltage (the capacitor) directly across \$R\$ resistor. Hence the discharge current is flowing in the opposite direction than in the charging phase.
And this is why during this phase the voltage across the resistor is negative. Because the current is now flowing in the opposite direction.
Initially this discharge current is large (\$I = 4.05562V/100kΩ = 40.55µA\$)
But as time goes on the capacitor continues to discharge process (via resistor ) and the voltage across the capacitor decreases exponentially with the time constant \$RC = 0.3s\$.
So, after 1s the capacitor voltage reaches this value:
$$V_C = V_{START}\: e^{\frac{-t}{RC}} = 4.05562Ve^{\frac{-0.5s}{0.3s}}=0.766V$$
And the current \$I_{(1s)} = \frac{0.766V}{100kΩ} = 7.66 \mu A\$
But now again the input voltage source switches back to \$5V\$.
And the capacitor will again start the charging phase (because Vin > Vc).
At this very first moment of transient (when Vin raeches 5V) the charging current becomes is:
\$I_(1s) = \frac{5V - 0.766V}{100kΩ} = 42.3 \mu A \$
At the end of a charging prosess (t = 1.5s) the capacitor voltage will be equal to:
$$V_C = ({V_{\infty}} - V_{START} )(1 - e^{\frac{-t}{RC}})+V_{START} = (5V - 0.766V )(1 - e^{\frac{-0.5s}{0.3s}})+0.766V = 4.2V $$
and the current \$I_{(1.5s)} = \frac{5V-4.2V}{100kΩ} = 8 \mu A\$
Because again at \$t = 1.5s\$ the \$V_{IN}\$ switches again back to \$0V\$ and the discharge process begins (I_dis = 4.2V/100kΩ = 42µA).
And ends up at \$t = 2s\$ with the cap voltage:
$$V_C = V_{START}\: e^{\frac{-t}{RC}} = 4.2Ve^{\frac{-0.5s}{0.3s}}=0.793V$$
And this is how the voltage across the cap will looks like:
And the current
And I hope that now you see what is going on in this simple circuit.
AC Circuit Having Only Capacitor