The swabs are used to check for explosives and/or drugs. Indeed, if you manipulated any such substances in the near past, it's likely that traces can still be found on your hands, and on the things your hands usually touch: bag handles, zippers, pockets, etc. If you pay close attention during the checks, these parts of your personal belongings are the ones that are usually swabbed. The TSA blog calls these swabs state of the art Explosives Trace Detection (ETD) tests
:
While going through checkpoints, you might have seen officers using little white swabs at TSA checkpoints at one point or another. In case you had no idea what our officers were doing, they were conducting state of the art Explosives Trace Detection (ETD) tests. And all along you thought they were giving your items a complimentary cleaning…
ETD tests are used in checkpoint, checked baggage, and cargo environments. We swab things such as laptops, shoes, film, cell phones, bags, wheelchairs, hands, casts - you name it. Certain procedures call for an ETD test.
Basically, our officers run the white swab over the area in question to collect a trace sample. They then place the swab in the ETD machinery which analyzes the sample for extremely small traces of explosives. The test takes a matter of seconds.
[...]
So as you travel, you might be asked for a swab of your hands at the checkpoint or gate. It’s painless and quick. The swabs are disposed of after each use and will not be used on more than one person.