Just in case you did not understand Point 2, dynamic braking, above. Here is another explanation.
In normal operations the diesel motor of a diesel-electric locomotive (the most common type) is used to run a generator that produces electric current which is then fed to electric motors on each axle and these motors turn the wheels thus moving the train.
But electric motors can also be used in reverse, to take the turning motion of the wheels and use this energy to produce electric current - in other words the motor becomes a generator.
This process takes energy from the wheels and therefore slows down the train. The electricity this generates, in diesel-electric locos at least, is simply "dumped" as heat into the environment. In electric locos it can be fed back into the overhead wiring for other trains to use.
The advantage of this is that the braking is achieved without undue friction and "wear and tear" on the wheels. The disadvantages are the heat it produces and the fact that dynamic braking is limited to the locomotives only.