Yes, dog food that has been exposed to heat can go bad. It can take as little as 2 weeks for this to happen.  Food should also not be exposed to air or humidity as this will make the food degrade.