Assuming charging and discharging paths are different. For capacitor a parallel discharge resistor is there and for Inductor a series discharging resistor is there
A capacitor opposes change in voltage and hence when the supply path is removed it tries to maintain the same voltage and thus current direction is reversed if it starts to discharge. The capacitor does not change its polarity. It just discharges from the initial value of potential towards zero.
An inductor opposes any change in current and hence to maintain this it changes polarity...