Elijah McCoy was born in Colchester, Ontario, Canada in 1843 to George and Mildred McCoy. His parents had both been slaves in Kentucky before they had escaped to Canada riding the underground railroad before the Civil War. When McCoy was young his family returned to America and moved to Ypsilanti, Michigan where his father worked in the logging industry.
Early on Elijah was fascinated with all things mechanical. He attended grammar school until he was fifteen. With money that they had saved up, his parents sent him to Edinburgh, Scotland to serve an apprenticeship in mechanical engineering. When he returned he was a full fledged engineer but he couldn't find work.
With his engineering training in hand, the only job that he could get was as a fireman (the person who put wood in the furnace) for the Michigan Central Railroad. In addition, part of his job was to oil the moving parts when the train stopped. It didn't take him long to figure out that this was quite a dangerous job since moving trains would often run into trains that were stopped on the tracks for oiling. (Remember the trains didn't really have any way to communicate with each other until Granville T. Woods invented the induction telegraph system in 1887.) To make matters worse, the need to stop the train for oiling was expensive and very time consuming. He began to work on self-lubricating devices to solve this problem and in 1872 he received his first patent for a lubricator for steam engines. His device allowed machines to be oiled automatically while the train was moving.
In the beginning, his device was belittled because a black man had created it but this didn't last long. His invention worked so well that people insisted that the "real McCoy" be in their engines, not some other device designed to do the same thing.