The battery is vital to the car’s operation.  The battery powers everything electrical: the engine’s computer, the ignition system, the radio, the headlights, electric seats, windows, etc. Like all batteries, they would eventually go dead if they were not recharged, so your car has a built-in recharging system. Most cars have an alternator, along with a voltage regulator, that keeps the battery charged and also provides electricity to the vehicle when the engine is running. A typical alternator can put out between 500 and 1,000 watts when necessary.
Because your car is so dependent on the battery, all cars have a battery light on the dashboard that is designed to warn you if the recharging system fails. A simple circuit looks at the voltage that the alternator is producing and turns the battery light on if it is low. (not enough voltage to charge the battery optimally) The battery light indicates a battery charging problem. If the battery light comes on and stays on while you are driving, the most common cause is a broken alternator belt. Total failure of the alternator is another possibility.
The reason why your car can operate normally even though the battery light is on is that your car can run off the energy stored in the battery. Your car will run fine until the battery goes dead. At that point, nothing in your car will work. When the battery light is on, you can still drive your car to the garage. You will not damage anything. But you want to get to the garage before the battery fails and your car dies.