How did old autopilots work?
It used a set of gyroscopes and pendulums that would correct the plane's attitude when it deviates. They were usually enhanced with pneumatic or hydraulic power to actually move the control surfaces.

For example the V-1 flying bomb (WW2 German UAV) could fly across the Channel and initiate a dive after a preset distance. It remained on course using a pendulum for pitch control and a gyroscope for yaw control. It used its inherent stability for roll control (no ailerons).