July 31st is the non-waiver trade deadline. This means any team can freely trade with any other team (subject to a few restrictions in the Collective Bargaining Agreement [no draft picks, no draftees signed less than 12 months ago, no players with 5-and-10 rights unless they approve, etc.] and subject to any restrictions in the contracts of the players being traded, like no-trade clauses).
After the non-waiver deadline, you can still trade players, but they must first pass through waivers. This means that all 29 other teams must fail to make a waiver claim on the player you are waiving. Once that happens, you’re free to trade him.