A broad differential CAVITY exists for the causes of a cavitating lung lesion. This ranges from malignancy to infection.
This was a large lung abscess - these typically occur in the immunosuppressed and/or those with background lung disease.
Large lesions can erode into pulmonary vessels causing hemoptysis, which can be catastrophic.