Where is battery data stored on macbooks?

That info is stored on the battery itself. With the exception of current capacity which is calculated, everything else is stored on the battery’s control chip.

Usually, on the same PCB as the battery protection circuit there’s a control chip that balances the voltage, measures capacity etc. It’s on this chip that things like the serial number, cycle count, etc, are stored. This is why when changing out a battery this info is “reset” without having to do anything on your Mac.

As for utilities like Coconut Battery, they’re good, but you can get the same info for free with built in commands.