Early aircraft needed the constant “hands-on” attention of the pilots in order for the flight to be conducted safely. However, as air travel developed and the distances covered became greater, flight times became longer leading to the possibility of pilot fatigue due to long periods of concentration. To solve this problem, an Autopilot was devised which could take on some of the tasks of the pilots.

The first Autopilot was developed by Sperry Corporation in 1912. Basic by modern standards, it connected a gyroscopic heading indicator and attitude indicator to hydraulically operated elevators and rudder. It permitted the aircraft to fly straight and level on a predetermined course without a pilot's attention, greatly reducing his or her workload.

Modern autopilots use computer technology which establishes the aircraft’s current position and then controls a flight control system to guide the aircraft. Besides the classic flight controls, it can also incorporate thrust control capabilities which can optimise the aircraft’s speed.

More Info: en.m.wikipedia.org