Why do planes have cross-feed switches or circuits?
The fuel system in aircraft generally includes a left and right tank within the corresponding wings. Each tank generally provides fuel to the engines on that wing. The crossfeed valve is used to temporarily connect the two sides of the system. This system allows the shortest route for the fuel and keeps the systems separate, so a leak on one side cannot drain the entire system. The crossfeed valve is generally kept shut for this reason. A couple scenarios illustrate when opening the valve might be necessary.

To keep the plane balanced, both wing tanks should have about the same amount of fuel. However, for various reasons, they could become unbalanced. The crossfeed valve allows fuel to flow from the tank with too much fuel to the tank with less fuel.

Another scenario would be the loss of an engine. In a twin-engine airplane, the remaining engine would need to be able to draw fuel from both wing tanks.

Note: especially in larger aircraft, fuel systems can be much more complicated, with multiple tanks in each wing and also in the fuselage. Fuel transfer also becomes more complicated.

Using the 737 as an example, this is the fuel system control panel with the crossfeed switch in the center. With the crossfeed valve open, turning off the fuel pumps on one tank will cause more fuel to be drawn from the tanks on the other side.