This is due to the first law of dynamics. by Newton Sir Isaac..
When the fan blades are in full speed, the friction is overcome by the additiona l power that the mains supply..
When the switch is off, then the momentum (angular) of the blades remains with the blades. Due to the friction acting on the blades at the center of the fan, the speed reduces slowly and gradually and then it comes to rest. Some energy in the fan wings is dissipated as heat due to friction. Some energy (in the momentum) is converted into work to rotate the blades for some more time.
If there is no friction, then the fans continue to rotate even after switching them off.