As a neurotypical child/adult (you don't have Autism Spectrum Disorder), you might wonder why a child would rock to and fro, or flap and wave their hands about. This is called stimming and isn't harmful. They might do this if there is a lot of sensory things going on around them, or they are anxious about something. Stimming calms them down and lets them take control of their emotions again. So, don't try to stop them.
As a child, I never did either of them (not that I know about, anyway). But one thing I know I did, up until just before my 21st, was bite my fingernails. This was down to anxiety I know now. Whenever I was at home, I'd be OK and my nails would start growing. But as soon as I went back to school or work in later years, I bit them again. This went on until just before I turned 21. I had been working for a couple of years. I think I had got used to the people there and the jobs I had to do, and had been so busy that I didn't have time to bite my nails. They began to grow. So I decided then to let them. I started wearing nail varnish to help me. Once they grew, I stopped, seeing how nice they looked. Now I cringe when I think about what I did, and when I see other people, usually men, bite their nails. I don't know how I let my fingers be like that, they must have been so sore and red.
When my dad used to live with us (he's in a care home now), I used to see him twiddle his thumbs. It annoyed me because I could see it happen out the corner of my eye when I read or watched TV. I now think that this was him stimming because I believe he has Asperger's too.
So, if you see a child either rock or flap, think about what's going on around them. Is there too much noise? Too many people? Being bullied?