What is alternator do?

This is an easy answer. The alternator is hooked
(through wires blue and black) to the battery. So every time you

start an engine the alternator kicks on and charges the battery. That's
practically how it works.
To add a bit to the above- an alternator produces an alternating electrical current (unlike a generator, which produces a direct current- DC vs AC) On modern cars, the alternator produces the current used to charge the battery, and operate electrical equipment on the car, such as lights, wipers, radio, etc.