A chain whip is used in conjunction with a cassette lockring remover to remove a cassette type gear cluster. It keeps the cassette freehub body from ratcheting backwards while the lock ring is being unscrewed.
The chain whip is used as a wrench to unscrew threaded sprockets.