Harden, the top scorer in the NBA for the past three seasons, will join the Nets in a deal involving three teams.
The 2018 NBA Most Valuable Player and an eight-time all-star, Harden, 31, had been reportedly looking for a move after growing frustrated at Houston.
They are second bottom in the Western Conference with just three wins.
The three-team deal also involves the Cleveland Cavaliers - as part of the trade, Brooklyn centre Jarrett Allen and forward Taurean Prince will move to Cleveland, and guard Caris LeVert and forward Rodions Kurucs go to Houston.
It will also see Cleveland guard Dante Exum going to the Rockets and several future draft picks exchanging sides.
"Adding an All-NBA player such as James to our roster better positions our team to compete against the league's best," said Nets general manager Sean Marks.
"James is one of the most prolific scorers and playmakers in our game, and we are thrilled to bring his special talents to Brooklyn."
The Rockets' defeat to the LA Lakers on Tuesday led to Harden's discontent. He was asked to miss Rockets training on Wednesday, having said that they were not good enough to be title contenders after the defeat at the Lakers.
"We're just not good enough - chemistry, talent-wise, just everything," he told reporters following the 117-100 loss.
"I love this city. I literally have done everything that I can," said Harden. "I mean, this situation is crazy. It's something that I don't think can be fixed."
Harden will be reunited with former Oklahoma City Thunder team-mate Kevin Durant at Brooklyn.
In 2017, Harden signed a contract extension with the Rockets worth a reported $228m (£176m) - the richest in NBA history at the time.