Why do I cough up phlegm that tastes like metal?

Blood. Sometimes with a very forceful cough there can be specks of blood or actual amounts of blood in the phlegm. Blood will have a typical metallic/iron taste.