In a d.c generator there is a coil that rotates between the poles of a magnet but unlike the a.c generator the two ends of the coil are connected to a split ring - a half circle of metal that is in contact with the stationary brushes.
As the coil rotates the side of it that is cutting downwards through the field (marked X on the diagram) is always in contact with brush 1. That means that brush 1 is always positive. In the same way the side of the coil that is going up is in contact with brush 2.
The device that ensures that the two brushes always have the same polarity is called a COMMUTATOR.
Output of a d.c generator
In commercial generators the performance of both types (ac and dc) is improved by having:
(a) a radial magnetic field produced by electromagnets with mutiple coils and
(b) a large number of coils on the rotor