Why do I cough up hard brown chunks of flem?

Lung infection. I assume you don't always cough up hard brown chunks of phlegm, just on occasion when you're feeling ill. That nasty looking phlegm represents your lungs reaction to infection, commonly viral, bacterial or fungal. Your family doc can help you decide if any (antibiotic) treatment is warranted. Average duration of cough illness is 18 days. If you're short of breath or feeling worse, go see your doc.