The 33-year-old joined Barca from Liverpool in 2010 for £17m after spells at West Ham, Corinthians and River Plate, and will leave on 26 January.
The Argentina international won 18 trophies at the club, including four La Liga titles and two Champions Leagues.
Former Manchester City manager Manuel Pellegrini has been in charge of Hebei China Fortune since August 2016.
The ex-Real Madrid boss guided his side to fourth in China's top tier last season.
Mascherano's international team-mate Ezequiel Lavezzi is also at the club, having joined from Paris St-Germain last year.
Mascherano played 334 times for Barcelona, scoring one goal - from the penalty spot in 2016-17.
Only three foreign players have played more games for Barca - Lionel Messi, Phillip Cocu and Dani Alves.
Barca will say farewell to Mascherano at a ceremony on Wednesday, and he will be at the club's Copa del Rey second-leg tie against Espanyol on Thursday to say goodbye to fans.