First and foremost, most trades in the NBA are suggested and mediated by agents.
Agents are significantly more incentivized than GMs to make sure their clients are playing on a team where they are both happy and in a position to make more money when free agency rolls around.
More often than not, an agent will approach a GM of Team X with something like, "Player A doesn’t fit into your current system here, or with the direction your team is heading. He’s not happy, and this isn’t working. Destination Y might make a lot of sense for him, and they have some pieces you would want."
This agent would then pick up the phone and call the GM of Y. "Hey GM of Y, I just got off the phone with GM of X. They’re open to moving my client, Player A, to your team. I was thinking that you could give back Players B, C, and a future second round pick. What do you say?"
And so on and so forth until the general structure of a deal is hammered out.