Various things... When i see a bad cough in clinic, and there's no clear infectious source like bronchitis, pneumonia or other type of viral illness, i start to look for things like asthma, gastric reflux, post-nasal drip. It usually takes a good history and exam to figure out the cause. Sometimes people have coughs that get better on their own, and we never figure out why they had it in the first place!
Acute or chronic? Possible diagnoses of an acute cough include acute bronchitis, bronchospasm. If the cough is present for 3 weeks or longer, possibilities include bronchospasm, gerd, post-nasal drip or a combination of factors. See your doctor for any worsening or persisting cough for diagnosis and treatment.