The 31-year-old Frenchman has been without a team since 31 January, after departing Turkish club Antalyaspor.
Nasri, who’s signed a deal until the conclusion of the summer season, functioned an 18-month doping ban for having the intravenous drip treatment however is available to play back from 1 January.
He won two premier league titles and the League Cup in six years together with City.
“Coming back to the most competitive league in the entire world, with a team full of dream with a director that I know…. It’s the best job on earth, and I am very excited about it,”” said Nasri.
Pellegrini told the Hammers’ web site:”I’m happy to be dealing together with him .
“He has been working very hard in recent weeks to build up his health and state after a long time without playing, and he is now very excited to go back to his finest.”
It was alleged that in 2016, while loan to Sevilla, he received 500 millilitres of hydration from the form of sterile water containing micro nutrient components, which exceeds the permissible limit.
In February 2017, a petition by Sevilla for a more moderate therapeutic use exemption (TUE) for Nasri was refused by uefa.
west ham have the choice to expand Nasri’s contract with a year.