The gearbox in a car works by transferring power from the engine to drive the wheels by employing a set of gears that can be shifted to change the speed and torque. The gears are arranged in different patterns to offer different speeds while maintaining the engine performance.