The 23-year-old will reportedly cost the Hammers an initial £30.5 million ($37 million) with a further £5 million in add-ons.
Scamacca had been linked with Juventus and Paris Saint-Germain after scoring 16 goals in 36 matches in Serie A last season.
“I am really excited to join West Ham,” said Scamacca.
“I’ve waited a long time for this moment – it’s been a dream to play in the Premier League.
“I feel like West Ham is the perfect team for me. They showed they really wanted me and when I spoke to the manager there was an instant understanding.”
West Ham had been in the market for attacking reinforcements to lighten the load on Michail Antonio up front.
“We’ve been looking to add more strength to our attacking options for a while, so we’re delighted to have got Gianluca in,” said West Ham boss David Moyes.
“He comes really well recommended – and we’re looking forward to working with him.
“He’s a young centre-forward with a really bright future ahead of him.”
Scamacca could make his debut against English champions Manchester City on the opening weekend of the Premier League season on August 7.