Could be a stim, could be a tic. The first one's voluntary-ish; the second one's mostly involuntary. I stim in a similar way, except it's individual muscles in patterns. I think many autistics learn to do this because it's one of the most surreptitious stims out there, and difficult to detect if you're not looking for it. But of course tics (involuntary movements) are not uncommon on the spectrum either; and the fact that you're doing this so often that it actually causes muscle soreness makes me think it might be one. If I were a doctor I would most likely wonder whether you might have a tic... if you had multiple tics, I might even wonder about Tourette's. But obviously I'm not a doctor and with the information I have, even if I were I couldn't say anything conclusively.
Should you see a doctor? Yes, if you feel this is a problem for you. The worst they can say is "We don't know how to treat that; here's some ibuprofen for the muscle soreness."