A transfer switch is an electrical device that is installed next to your electrical panel in your home. It connects to the circuits in your electrical panel that you wish to power during an electrical outage.
This allows you to power these circuits by connecting the generator to the transfer switch, instead of having to run extension cords to various items.
The main breaker in the transfer switch switches the power source from utility to generator. The house cannot be connected to both the generator and utility power at the same time - the main breaker transfers power from one source to the other. This prevents the generator power from back-feeding through the utility lines, as well as preventing utility power from back-feeding into the generator