It can be a sign of pain, discomfort or irritation.
One of the only time a horse naturally swings t's tail during riding is in a changement.
– But It can come from many different things, such as pain, too high use of spurs or a poorly adjusted saddle.
It can have many significations actually! It can be a pain in the back especially, or in the teeth, in the limbs... Maybe you acts too much with your hands or legs? Or maybe you ride with spurs or a whip?