A lot of people on the autism spectrum may show behavior that is recognizable to others around them. Some flap. Others rub their hands together. Some squeal with delight at things that excite them. For some people, it may be more discreet, such as wiggling their legs while sitting or fiddling with their fingers. These behaviors are what as known as stimming, or seeking sensory input.
For whatever reason, those of us on the spectrum crave sensory stimulation of some kind. This seems to ease tension or release pent up energy. If we can't let the energy out, it causes frustration, which can turn into a meltdown for some.
For me, stimming probably looks like nothing more than fidgeting to the outise observer. I do the leg wiggling, and I sometimes fixate on my fingers and tap them on things. Sometimes I stretch my muscles. In my experience, it's the combination of ADHD and Asperger's that plays a part in all of this. I stim because I have pent up energy, and also because I can't sit still for very long. It helps me to concentrate.
As you see, this is one of the ways the wide autism spectrum manifests itself. The next time you see someone doing any of these things, remind yourself that they're doing so to calm themselves and that it's okay! As humans, we all have things that help us to keep our cool in any kind of situation.