My chest hurts sometimes my doctor said that it hurts because of hyperventilation. And that I don't have to worry. Can somebody clarify and help?

Anxiety. Chest pain could be a symptom of anxiety. Hyperventilation is also symptom of anxiety. Reassurance and may be a mild anxiolytics may help.
Paper bag "cure" Hyperventilation is when you breathe more than your body needs, usually out of anxiety. Unfortunately the resulting dizziness (& sometimes other symptoms like chest aching) adds to the anxiety, creating a vicious cycle. It's not serious. To break the cycle, try breathing in & out of a small paper bag, eg, a lunch bag. Re-breathing the same air eases the symptoms. And try not to over-breathe.