How and why can cold inflict pain?
I think your getting confused. Your assuming that it's actually the heat or cold that creates the feelings of pain. 


  I was very surprised. cold is just atoms moving slower.


Pain is a warning mechanism, stop doing that or you'll hurt yourself. It is not caused by the atoms in your nerves moving faster or slower in response to heat. Your nerves are triggered by a stimulus that could cause harm to your body and react by passing a pain signal to your nervous system. The heat (or lack of it) does not transmit up your nerves.