When utility power is functioning the wires from the circuit breaker in the main electrical distribution panel are connected to the generator sub-panel. If utility power fails, the switch connects the generator's power to the circuits in the generator sub-panel.
Additional information about electricity.