Anwar, 20, caught the eye in a couple of reserve games for the Owls and will now be hoping to play a part in Wednesday's fight against relegation.
Hammers' Football Secretary Peter Barnes said: "Anwar is joining Sheffield Wednesday in a permanent deal and goes with our best wishes for the future."
Anwar himself said via a statement: "I would like to thank all the coaching staff at the club for everything that they have taught me in the seven years I have been at the club.
"I am proud that I was part of one of the most successful youth teams in the country and now I am looking forward to the challenge ahead of me at Sheffield Wednesday.
"They are a massive club with a 40,000 all-seater Stadium and I want to be part of the team that can help fill it."