Braking systems are of many types and the most popular braking system is frictional braking system, the type of braking very commonly seen in bicycles where a rubber pad is pressed against the wheels to apply brakes.
In cars the system is slight advanced, we use drum and disk types of frictional braking systems, but that technology is very old
See braking is dissipation of kinetic energy (motion energy), anything can which can dissipate kinetic energy will make a system to stop
Friction bake covert kinetic energy into heat energy and system comes to halt.
Now apart from frictional dissipation there can be another way by which we can stop a body i.e. dissipate this kinetic energy into electrical energy
This is done by a new type of braking system which is called the Regenerative Braking System in which the when car brakes the rotating motion energy is transferred to the electric generator which sends generated electricity to a battery which stores this energy
This kinetic energy is wasted with frictional braking, but modern cars use this regenerative braking to add up to fuel economy as this battery is used to supply axially power to car systems and sometime as main driving mechanism
Do you know, metro rails are using this regenerative system from very long time, they feed the grid this extra power while braking and thus save lot of power
*image source Department of Transport, State Government of Victoria, Australia.