Thermal management is important for battery performance and health
The optimal temperature for a battery is around 20-30 degrees Celcius for operating. For storage, the optimal temperature is even lower.
A battery pack has a thermal management system to try to keep the battery in the best operating condition.
This includes cooling when in use to not overheat.
On some cars, it can also heat the battery before charging to improve charging performance.
This is called Active Precondition. On cold days this is necessary to get the full charging speed. Without it, charging will take a longer time to get to full capacity.
In the picture below you see both cooling circuits and an auxiliary heater that can heat the battery when cold.
In this clip, you see details about the thermal management system on Audi e-tron GT.