There are many reasons why a cough can cause chest pain, and it can be due to cancer. But it is more likely to be caused by pneumonia or trauma. 1. Cancer: lung cancer, esophageal cancer, with the growth of tumor, the tumor cells will invade the tissues of upper abdomen, causing inflammation or damage to the chest and upper abdominal tissues, and the patient will pull the damaged organs when coughing, thus causing pain. 2. Pneumonia: When pneumonia is serious, it will involve the pleura and cause chest pain. When the patient coughs, the pain will be aggravated. 3. Trauma: If the patient’s chest is bumped or squeezed, the bones, muscles and soft tissues of the chest will be damaged, and when coughing hard, the damaged parts will be frustrated, thus causing pain. Bronchial diseases and tuberculosis and other diseases, can also cause symptoms of chest pain when coughing, patients should go to the hospital for timely examination.