When you complete hard exercise, especially if you're out of shape, the heart ends up working a lot harder than usual. This causes pulmonary edema which is fluid build up in the lungs. There is a leakage of red blood cells into your lungs. Eventually hemoglobin can escape into your throat which gets carried into your mouth as you exhale. Hemoglobin is made up of iron so that explains the taste!
When I was younger (and didn't do much other than surf the internet) I experienced this feeling all the time. Gym class was just me snacking on iron. I hated it and it made me avoid exercise even more!
Further Reading: ELI5: Why does saliva taste like blood when you exhaust yourself?