The accelerator regulates engine output by controlling airflow. In older cars, the gas pedal connected directly to the carburetor or throttle body via a steel cable. Stepping on the pedal physically pulled the throttle plate open, letting more air in. The engine would then draw in more fuel to match, causing the car to speed up.
In modern vehicles, this mechanical linkage is gone. Cars now use a drive-by-wire system. The pedal connects to a sensor that measures how far you press it. The engine computer reads this signal and uses an electric motor to open the throttle plate. This digital system allows for traction control and cruise control to manage engine speed automatically.
If the accelerator linkage sticks, it can cause the engine to rev out of control. Regular cleaning of mechanical throttle cables is needed to prevent binding. For electronic pedals, sensor faults will trigger a fail-safe mode, limiting engine speed to keep the driver safe.