I used to do something sort of like that with my thumbs (mostly my right one) that's sort of hard to describe, but basically I move it around in circles at the edge of it's range of movement and there is this one thing I can do which causes a small cracking sound if that makes any sense. After a while it makes my thumb start to hurt so I try to force myself to stop and replace it with something else until I succeed.
So yeah, it's likely a stim (unless you have restless leg syndrome). You should try to replace it with something else, when you find yourself doing it don't just stop yourself but start doing another less harmful stim instead. That's what has worked the best for me.
_________________
Also known as MarsMatter.
Diagnosed with Asperger's, ADD, and Generalized Anxiety Disorder in 2004.
In denial that it was a problem until early 2016.
Deviant Art