According to the text, the inventor James Watt is credited with the invention of the steam engine. The text mentions a story that he was inspired by observing the lid of a boiling kettle being lifted by steam.