Hello!
When the battery light comes on while the engine is running, it usually means the charging system is not working correctly at that moment. Since it comes and goes, the problem is likely intermittent.
The most common causes on the Fiat 500 are:
• Weak or ageing battery – if the battery voltage drops, it can trigger both the battery light and sometimes the engine light.
• Alternator or voltage regulator starting to fail – charging may stop occasionally and then come back.
• Loose or corroded battery terminals or ground cables.
• Serpentine belt slipping or the belt tensioner getting weak.
• Connector on the alternator not making good contact.
First simple checks you can do:
Measure battery voltage with the engine off (should be around 12.5–12.7 V).
Measure with the engine running (should be about 13.8–14.5 V).
Check that the battery terminals and ground cables are clean and tight.
Look at the serpentine belt and make sure it is not loose or worn.
Because the check engine light also appeared, it would also help to scan the car for fault codes, as the ECU may have stored a charging-system related error most probably.
If you can post the engine type and any fault codes you find, it will be easier to narrow it down.