The food stuff contains acid like vinegar. Iron is a reactive metal, it reacts with acid and forms iron salt and hydrogen is displaced . This leads to eventual eating away of metal. Thus both metal container and foodstuff are spoiled.
Fe (s) + 2 CH3COOH (aq) (CH3COO)2Fe + H2 (g)