To put it simply, the alternator is like a mini generator for your car…
While your car battery is a source of power when the car is turned off, your alternator is the source of power when your car is running.
Every time you drive your car, the battery is getting charged back up again by the alternator. When you use your wipers, air conditioning or your headlights while driving, these all run off the alternator, so your battery is not being drained while you drive.
When you alternator fails, it doesn’t do its job to charge up the battery. This is just one of the reasons a battery can fail.