Things like rocking can be a way of "self soothing". Kids will do it to calm themselves and their nervous systems. I would let him do it. No, I disagree about medication out there to stop rocking. If you sense that he is doing it due to anxiety, then I'd address the anxiety which can be started without medication. But some kids will spin, rock, etc. to "slow" down their engine.
One thing that might help is to give him plenty of physical activity at other times during the day. This may sound the opposite to slowing the nervous system-------- but physical activity does it naturally and then a child will have less of a need to rock.
My son would spin. His nervous system is in overdrive at times. We have found that more things like swimming, soccer, running around, etc. will calm him and he has less of a need to spin.
good luck
Does he have autism? That is a common symptom of kids with autism. It could also be a tic. You should have him checked by a doctor. There may be medication that can help him if it is disruptive.