The big fuel tank has significant foam insulation because its two major fuel components are kept very cold (liquid oxygen at -300F/-180C; liquid hydrogen at -420F/-250C) and the external surface gets fairly hot at the speeds the shuttle travels.
Lockheed designed the tank with insulation outside the main shell, and it's never held together very well. I've spoken to retired engineers from another company who designed a competing tank with internal insulation; they're still upset their version didn't get picked. I've never heard a clear explanation as to the specific reasoning for Lockheed or NASA's decisions.
Of particular note, the Columbia disaster was caused by one of those foam pieces breaking off during takeoff and damaging the thermal protective tiles on the shuttle's wing. During re-entry, the edge of the wings reaches a temperature of around 3000 F; damage to the protective tiles basically allowed hot air to burn through the wing.