Who invented the sewing machine and why?

Walter Hunt was the first American to build a working sewing machine, but he didn't patent his invention. He did not want to cause seamstresses to loose their jobs.

Elias Howe invented the first Automatic Sewing Machine. Howe obtained the first patent for the machine.

Howe worked for Ari Davis and fixed nautical equipment and was constantly working on sewing machine in need of repair. These machines inspired him to create a sewing machine that was would fit the need of seamstresses. Watching his wife sew, he realized he needed to work on a machine that would use thread supplied from two different sources.