Modern climate control isn't a simple on/off switch anymore. A mid-2010s or newer vehicle has an HVAC control module — essentially a dedicated computer — that talks to your main engine control unit, monitors cabin temperature sensors, blend door actuator positions, and fan motor speed. The compressor clutch is engaged by a relay controlled by software logic. The blend doors that mix hot and cold air are moved by small electric motors called actuators.
When any link in that chain breaks — a bad actuator, a failed relay, a corroded connector, a faulty temperature sensor — the module either commands the wrong output or throws a fault code and defaults to a safe state. "Safe state" often means maximum heat or maximum cold, which is why you sometimes get stuck with one extreme and no adjustment.