Powering CO2 sensor with Battery
Three possible reasons.


You didn't connect the ground of the battery/sensor to ground of the RPI.
The battery sees too low of a draw and goes to sleep. Common power save feature on newer power banks.
The switching supply on the power bank is too noise for the sensor. Try adding a filter cap or two.