Although, there could be several reasons behind a cat wagging it's tail, one potential reason is If a cat is wagging its tail in a violent swishing motion this could mean that the cat is hunting and is about to pounce. Another possibility is if the cat is slowly wagging it's tail, it often means the cat is stressed.
According to CatChannel.com, if a cat thumps its tail up and down while an owner is petting them, this is often a sign of irritation and it means that the cat doesn’t want to be touched anymore. A twitching tail often means the cat is frightened or upset. Wagging tails often also mean a general sign of stress. It usually means the cat doesn’t want any more interaction with humans for the moment. If a cat holds its tail low to the ground and twitches it side to side sharply, this often means the cat is close to biting or scratching someone. Scared cats raise their tail up high and stiffen the entire tail with the exception of the tip to indicate fright. Other mannerisms in a cat also show their mood. For example, if a cat flattens its ears near its head, this often indicates that the cat is frightened. If the cat’s whiskers push forward while it’s kneading an area like a blanket, this often indicates that the cat is curious and happy.