The Morocco international, 26, who spent two seasons with the French Ligue 1 club, has signed a five-year contract with David Moyes’ side.
“I was really excited when I heard about West Ham United’s interest,” said the left-sided player.
“When I heard about it, I knew I needed to go to the Premier League, because it’s a dream for every player.
“West Ham is a historic club. I saw a few of their games this year, and I saw the fans and the atmosphere were fantastic.”
Moyes, whose side finished seventh in the Premier League last season, said Aguerd had been on the club’s radar for some time.
“I am delighted to welcome Nayef to West Ham United,” said the Hammers manager. “We have tracked his progress for some time and I’m very pleased that we have been able to complete the signing. He’s a great addition that will add to our defensive options.”