You have to have the badge and battle The Heartbreaker Charles. He's the guy on the motorcycle.
In Black 2 and White 2, he is encountered at first on Route 5, where he prevents the player from entering Driftveil City until they beat the Nimbasa Gym due to having a battle with another Trainer. Once the Gym is beaten, he can be battled in a mandatory Rotation BattleB2/Triple BattleW2 and will let the player pass once defeated. Later in Driftveil, he can be fought again, this time in a Triple BattleB2/Rotation BattleW2 with the same team as before.