A defensive rotation in basketball is when a team switches defensive assignments in a single play. This means if a player has to guard a different player on a possession, then the entire team might have to switch and guard different players as well.
There are many situations that call for a defensive rotation, and in man defense it is usually on the players to know when they must rotate. The most common examples of rotation are when a guard drives by a defender and the big man must leave their defender to block the rim. This creates a cascading effect where a wing defender must rotate down to prevent a drop off to the now open offensive big man while the originally passed-by defender has to rotate onto the offensive wing. While it sounds like a lot of movement, as long as the players communicate well about who they are switching on to the rotation will be executed efficiently.
In zone defensive schemes, rotation occurs more as a cohesive unit than on an individual basis. As the ball gets passed around the top of the key, for example, each defensive player will take a few slides in that direction so that they can adequately front the offensive players and not allow easy passes through the seams.
Other types of rotations are not reactionary and rather purposeful, like traps. A trap is when a player leaves their designated assignment to double team an opponent when they are in a vulnerable situation, making it hard for them to dribble the ball. The other defensive players must in turn rotate to guard the easy pass to the open player to put even more pressure on the ball handler.