Murdoch was the inventor of the oscillating cylinder steam engine, and gas lighting is attributed to him in the early 1790s, also the term "gasometer". However, Archibald Cochrane, ninth Earl of Dundonald, had already in 1789 used gas for lighting his family estate. Murdoch also made innovations to the steam engine, including the sun and planet gear and D slide valve. He invented the steam gun and the pneumatic tube message system, and worked on one of the first British paddle steamers to cross the English Channel. Murdoch built a prototype steam locomotive in 1784 and made a number of discoveries in chemistry.
Murdoch remained an employee and later a partner of Boulton & Watt until the 1830s, and his reputation as an inventor has been obscured by the reputations of Matthew Boulton and James Watt and the firm they founded.
William Murdoch was born in Lugar near Cumnock, Ayrshire, Scotland, the third of seven children and the first son to survive beyond infancy. A son of John Murdoch, a former Hanoverian artillery gunner and a Millwright and tenant of Bello Mill on the estate of James Boswell in Auchinleck, he was educated until the age of ten at the Old Cumnock Kirk School before attending Auchinleck school under William Halbert, author of a highly regarded arithmetic textbook. Murdoch excelled in mathematics. Murdoch also learned the principles of mechanics, practical experimentation and working in metal and wood by assisting in his father's work. Together with his father, he built a "wooden horse" about 1763. His "Wooden Horse on Wheels" was a tricycle propelled by hand cranks. There are reports that in his youth Murdoch was responsible for the construction of one of the bridges over the River Nith; this possibly derives from his father's work in building the Craikston Bridge over Lugar Water in 1774, which William would have been involved in. He is also said to have carried out experiments in coal gas, using coal heated in a copper kettle in a small cave near his father's mill. However, there is no contemporary documentation.
In 1777, at age 23, Murdoch walked to Birmingham, a distance of over 300 miles (480 km), to ask for a job with James Watt, the steam engine manufacturer. Both Watt and Murdoch were probably aware of each other because of their connections with James Boswell, who had made several visits to Watt's workshop at Soho. Watt's partner Matthew Boulton was so impressed by Murdoch's wooden hat, made on a lathe of his own design, that he hired him. Murdoch began his career with Boulton and Watt in the pattern workshop of their Soho Foundry, making patterns for the casting of machine parts. By 1778 Watt wrote: