NBA Rules question:

In many NBA games, you’ll see a player (from Team A) intentionally throw a ball off of a player from the other team (Team B) so that the ball is considered out of bounds on Team B, thereby securing possession for Team A. Generally, this happens when the ball was last touched by Team A and is headed out of bounds, and when the Team B player is standing in bounds.

But who gets possession if the Team B player is already standing out of bounds? Now throwing it off of the Team B player is similar to throwing it off of a chair or a fan, isn’t it?

The ball is always given to the team that didn’t touch it last inbounds.
In the OP’s scenario, Team A was the last team to touch the ball inbounds. So the ball belongs to Team B.

In international ball, you can’t do this, but it’s legal in U.S. high school, college, and pro ball.