Hello,
the reason why anxiety causes symptoms like chest pain and problems with breathing is that anxiety is (and to some extent panic attacks, too) are, when you get to the bottom of the problem, basically fear - only that fear is not caused by some objectively threatening situation in the outside world. Instead, anxiety is fear caused by internal or mental factors, but it still causes the same body reaction, usually known as 'fight or flight' response, that involves secretion of hormones that have a deep impact on your main body functions - heart rate, breathing, muscle tone... In realistically frightening situation, this response would actually help your body prepare to fight (or run from danger), but since the fear is caused by something internal, the hormonal response instead causes you to feel the way you do when you are having anxiety or panic attack.
Anti-anxiety medication can help you relax in situations like these, but also, learning what is actually going on can help you feel more in control of your body.