What causes dystonia in the muscles?

It varies. Dystonia is a movement disorder that is typically caused by a problem with signals in the brain that affect movement. Some forms are caused by injury to a part of the brain called the basal ganglia (like stroke or cerebral palsy), others can be hereditary. Rarely it can be triggered by trauma. Some forms like cervical dystonia (torticollis or neck dystonia) are of unlcear cause.