Inverter / chargers serve a dual function one is to charge the batteries most generally the house bank and two to provide AC power to low draw appliances and outlets.
Switching is done automatically inside the inverter/charger. When it goes from being a charger to an AC power supply for the vessel. Improper installations of inverter/chargers are a really big problem. Improper installations can create back feeding of unwanted AC current into a vessels AC power system and can create a shock hazard and or trip the ELCI breaker at the dock. There have been so many inverter installation issues that ABYC has given them a special place under A-31 Battery Chargers and Inverters.
When a boat is connected to shore power the inverter/charger is in pass through mode most of the electricity simply by passes through the inverter and goes straight to the loads connected to the inverters AC output. The charger portion takes some AC power for battery charging. When shore power disconnected the inverter becomes the new power source taking DC power from the battery system making new AC power becoming the new power source for the vessel. Switching inside the inverter ties the neutral and the ground wires to together. It is important that ALL AC loads both neutral white and Black hot come back to the power source. To facilitate this requirement a separate neutral buss for all Inverted load must installed. With out a separate neutral buss a dangerous back feed of 120 volt into the rest of the AC system can occur. It is one of the most common and dangerous mistakes when unqualified boat owners install an inverter charger on their own.
I have spent many an hour trying to trace fix incorrectly installed inverter charger issues. So it is very important to have a good qualified ABYC tech do your next electrical upgrade.