Although I may not help you out on why do your muscles get sore, but I could share a few tips on alleviating the soreness after working out.
First, there is no definite way to prevent the pain for surfacing. Your body should recover itself through resting; also, taking extra proteins during this period will help to develop muscles. Natural anti-inflammatory food such as cherry juice could help to minimize the pain, or at least take your mind away from the pain temporarily as you enjoy the drink after a nice workout. Rubbing heated ointment on the area of soreness have proven itself to be an effective remedy, it’s something that as far as I can tell, a practice that only the Asians do. It works great for me personally too! Just be wary of the smell, it can be pretty strong.
I’m not sure about western medicine, but, I refuse to take any form of pills or supplements that promise pain reliefs, I don’t condone performance enhancing tablets as well, just stick to healthy food and let your body do the rest naturally. On the professional level, athletes will often bathe themselves in a tub of ice-cold water; however, this only helps to enhance recovery, not the pain.
If you really are afraid of the sore afterwards, start any new exercise slowly and push for more gradually, give your body time to get used to the movements. Unfortunately, warming-up and cooling down exercises do not in any case proved to prevent the pain symptoms. Still do them, however, warmed-up muscles reduce injury and help to start up your exercises. Similarly, stretching has little effect on the pain but might actually make it worse. All in all, just do the exercises correctly, especially when stretching, ask a friend or a fitness instructor if you aren’t sure. Feel free to continue your routine while the pain is still there. The pain might go away during the exercise but comes back later on to haunt you. If the pain bothers you too much, then do something lighter until you can deal with it, return to your usual routine afterwards. So don’t let the pain discourage you! Believe in yourself that you will and can follow your regime. Happy exercising!