Nicolaus Otto was a traveling salesman who at age 30 began testing his ideas of how to build an internal combustion engine. He had seen an engine built by Lenoir and thought he could see how to improve on the Lenoir engine. His design was not very good, but he met Eugen Langen, owner of a sugar factory, and together they made an improved engine. Entered in the 1867 World Exhibition in Paris, their engine won a gold medal for the most economical engine for business. The Otto engine proved to be powerful and light compared to steam engines, and in the next decade over 10,000 engines were produced.
The Otto engine was of the four stroke type which utilized the new concept of compressing the gas mixture before ignition. The up and down motion of the piston in the cylinder performed 4 steps in two revolutions of the crankshaft: intake of new gas mixture into the cyinder, compression of the gas to the top of the cylinder, explosion of the gas that pushes the piston down, and expulsion of gasses from the cylinder. Here is a fun animation of a 4 stroke engine cycle, by Matt Keveney. Another animation shows a graph of pressure as the piston performs its tasks.
One worker at the Otto Engine Works was Gottleib Daimler, who later put engines like the Otto engine to work to drive vehicles.