Orlando also included forward Gary Clark in the deal.
Gordon, 25, acknowledged Tuesday that he had asked Orlando for a trade. He said he made the request because of his "frustration" with the team on a number of issues.
"There's been times where I just expressed my frustration to management," Gordon told reporters. "Frustration with the losses, the injuries, the way we've been playing and how many losses have accumulated over the years. So it's just my frustration kind of boiling over, I would say. ... I think a lot of people share that sentiment with me, of frustration."
Gordon was selected by the Magic with the fourth overall pick in the 2014 draft. Since Gordon was selected before the 2014-15 season, the Magic have gone a combined 203-322, qualifying for the playoffs just twice and getting knocked out in the first round each time.
Gordon is averaging 14.6 points and 6.6 rebounds per game this season.
Clark appeared in 35 games for the Magic this season, with 11 starts. He averaged 3.4 points and 3.2 rebounds over 18.2 minutes per game.
Harris has long been a favorite of Denver's coaching staff due to his defense. He's been plagued by injuries since being picked 19th overall in the 2014 draft. Playing time has been sporadic for Hampton, who is averaging 9.3 minutes per game.
The Nuggets made it to the Western Conference finals last season before losing to the eventual champion Los Angeles Lakers. The team currently is 26-18 and in fifth place in the West standings.
ESPN's Nick Friedell and The Associated Press contributed to this report.