The invention of the Sterling engine is credited to Reverend Dr Robert Sterling and his brother and engineer James. They designed the engine to be safer then steam boilers which often injured or killed people when they exploded. The sterling engine uses a gas as its working fluid and their is no phase change as in a steam engine, so the pressure is lower and the risk of explosion is low.
Sterling was not the first one to create an engine to use air in a closed cycle but he was the first to take out a patent on one in 1916. One of his improvements over previous designs was the use of a regenerator. The regenerator removes heat from the gas as it moves from the ht side of the engine to the cold side and rejects it back to the gas as it moves from the cold side to the hot side reducing the amount of heat require to heat and cool the gas.
One of Robert Sterlings model engines was given to Glasgow University and lay forgotten for many years. It was later discovered by William Thomson in 1847 and he used the model to prove that the engine worked on a reversible cycle. William Thomson later became famous for work on thermodynamics and was known as Lord Kelvin.
Sterling engines were used to do many tasks until they were almost completely replaced by electric motors and internal combustion engines. General Motors had a program to developed a sterling engine powered car but this was dropped in the 1970's.