There can be two reasons:
1. The original virus that you have been fighting off may have moved further down your respiratory tract, triggering a dry cough, whereby nothing much comes up. This can become very painful, with repeated spasms of hacking coughs that aren’t productive but just keep you awake and put your chest muscles through the wringer.
2. A secondary bacterial infection may have developed in the lower respiratory tract, as a result of which your body is busy lifting phlegm off the lungs and bringing it up through the respiratory tract to be blown or coughed out. This – the productive, mucus or chesty cough - is an important part of clearing the debris after a respiratory tract infection (cold or flu). Unfortunately it is also a boring, noisy, and painful process. It’s important to avoid staying in rooms that have very dry air – put bowls of water on or near radiators and add essential oils such as Po-Ho to them, or to steam inhalations.
Coughing can quickly irritate the sensitive respiratory tract lining so that the cough itself keeps triggering the cough reflex even when there is nothing more to cough up. There are remedies you can use to relax these coughing spasms and encourage them to fade away.
Try not to have many dairy products or much refined sugar whilst you are coughing, as these can add to the load of mucus that has to be expelled.