Kids do all kinds of weird stuff. Mine would bang her head on things. She did it for a few months and then just stopped after we started just ignoring it. She also liked to spin in a circle until she was so dizzy she couldn't stand up and would be happy to do this far longer than an adult would find it amusing. She thought it was great. She also stopped doing it after a while. When my daughter was learning how to walk, and motor skills were being developed, she'd rock, shimmy and wiggle herself in all sorts of weird ways to feel out how her body worked.
Kids like exploring their world in different ways. If he's doing the rocking in his spare time and it's not interfering with him eating or sleeping, then I wouldn't worry unless he's still doing it when he's older and stops responding to external stimuli.