The very first steam engine that we know about was built in ancient times by the Greek Hero of Alexandria (10-70). He called it an "aeolipile" (see link for more info.)
In modern times, Englishman Thomas Savery (1650-1715) is credited with the first crude steam engine. As is the case with most inventions, improvements or the addition of critical components that others may make to a device cause most to believe that those who improve it are the actual inventors. Similar tales can be told for the telegraph and radio, for example. In this case, Englishman Thomas Newcomen (1664-1729) and later, Scotsman James Watt (1736-1819) both modified the design of the steam engine so it was much more efficient and allowed it to be further developed into a power source for locomotion and manufacturing, leading to the Industrial Revolution.
There are at least a few different ways you can answer this question. That is because, as is the case with a lot of inventions, the first person who came up with any sort of steam engine is not the person who is most famous.
The first person you can credit is Thomas Savery. He invented a crude steam engine in 1698.
The next one is Thomas Newcomen. He and a partner built a steam engine in 1712 that was able to pump water up out of mines.
The most famous "inventor" of the steam engine was James Watt. He modified the Newcomen engine very significantly. His changes (made in the 1760s) were so important that he is often credited with inventing the steam engine.
Like the previous post, this is a difficult question to answer. A part of the reason for this is, because history is not easy to discern. If we take the basic concept of boiling water to create steam for power, then people in the ancient world did this. This has been known for a long time, probably over 2000 years ago. But the greatest strides in steam engines were made during the industrial revolution, where people burned coal or wood to create steam engines. During the industrial revolution, the engine developed further.
The first person to harness the power of steam was the Greek scientist Heron of Alexandria in the first century A.D. He developed several devices that were operated by water, steam, or compressed air, including a fountain, a fire engine, and the steam engine. The steam engine was significantly improved in 1711 by Englishman Thomas Newcomen (1663–1729), who created a machine that used steam to pump water. The Scottish inventor James Watt (1736–1819) substantially improved on Newcomen's model and patented (received exclusive rights to make, use, and sell) his own steam engine in 1769. Steam engines had previously depended on atmospheric pressure to push a piston (a sliding piece of metal moved by pressure) into a cylinder (a hollow tube) and create a vacuum by the cooling steam. Watt's invention was the first to employ a separate device, called a condenser, which performed this function. The condenser resulted in a 75-percent saving in fuel. It also allowed for the use of steam pressure to move the piston in both directions, giving the machine greater flexibility. Watt's advances paved the way for the Industrial Revolution (a period of technological development; c. 1750–c. 1850), which relied heavily on this machine to move from reliance on agriculture to an industrial-based economy. Watt's legacy also includes the terminology "horsepower" and "watts" as units for measuring the energy produced by an engine.
Further Information: Hills, Richard L. Power from Steam: A History of the Stationary Steam Engine. New York: Cambridge University Press, 1993; "Steam Engine." MSN Encarta. [Online] Available http://www.encarta.msn.com/find/search.asp?search=steam+engine, November 8, 2000.