Have you been to a doctor?
Are you running a fever? It sounds like you could have pnemonia or bronchitis. A chest x-ray will confirm if antibiotics are needed. Otherwise, try to keep your cough productive, take nsaid for pain.
Welcome to the MedHelp forum!
Stress and anxiety are the most common causes of hyperventilation. It can also be due to transient ischemic attacks, head injury, lung diseases, or due to any form of acidosis. Rapid shallow breathing is seen in carbon monoxide poisoning. Rapid deep breathing is seen in anemia and severe infection. It is difficult to comment beyond this at this stage. Consult a doctor immediately or go to the ER to get this investigated. Take care!
Doctornee explained things nicely.
To amplify, breathing controls the acid-base balance in the bloodstream. When you exhale you "blow-off" carbon dioxide. This reduces the acidity in the bloodstream. The heart can only function within a narrow range of values in terms of acidity. As Drnee states, whenever the blood becomes too acidic, involuntary rapid breathing develops. It is how the body maintains homeostasis.
It is common with out-ot-control diabetes. This "fast rapid breathing" are called Kusmal respirations.
I would suggest you fo to the emergency room if you are continuing to have this problem as you read this. It is not necessarily life-threatening, but suggests caution.