After years of study it looks like the cause of pain after a whiplash injury is damage to the neck joints. The muscles seem to recover but the cervical joints may need to be "reset" in their ability to detect and fine tune motion.
Of course there may be other important factors. For example, psychosocial effects such as nervousness and loss of sleep may play key roles. One study showed that a prior history of head trauma and headache leads to a worse result after an injury.
It's not really clear why some people have a worse result than others. Studies continue to look for factors to predict the outcome. This may help us reduce the risk of injury after an accident.