Automakers and battery companies, which now face a weak market for electric vehicles in the US, are scrambling to repurpose battery factories to make energy-storage systems to fuel AI's demand for power instead.