Millipedes smell bad, simply put, out of the need for self-defense. Many of these lengthy arthropods protect themselves by emitting poisonous and disagreeable-smelling fluids from their glands. When millipedes feel in any way bothered or apprehensive, they typically react by giving off these smells. It's common for them to release the odor when people touch them. Some species can even spurt the stuff several inches.
I hope this helps! Good luck. :)