Direction current in DC motor do not change but is AC motor direction of current changes.
In DC motor, magnets remains stationary and when current passes through the coil, coil experiences the force due to the permanent and moves continuously.
In generator we use split rings, if direction of current do not change , so north pole will attract towards the south pole.
That is why direction of current changes in generator.