It has less use in-game, but competitively, it allows you to "phase", i.e. it allows to force out stat stallers, so things that continually use moves like Bulk Up or Calm Mind, and whirlwind forces them to switch out, resetting their stats.
It also allows you to mess up Baton Pass teams, which pass stat boosts to other Pokemon in order for a sweeper to sweep without having to switch out.
Whirlwind, however, doesn't work if Ingrain is used.