I think it is a mature male thing if I remember correctly. Some kind of breeding thing.
I have seen it happen with other ball pythons, not my own though.
It is pretty hilarious. I think if you check youtube for "ball python tail wagging" you should get some videos of it.