Bread kept in a container got spoilt after some days because:
Container was not airtight
Mold spores can accumulate in the dust around the atmosphere, which is kicked up through cleaning or even someone walking by. The spores can then settle on bread and the bread molding process will begin. Mould will not only live and feed on bread, it will also reproduce there. This is why bread kept in a container got spoiled if you let it sit there long enough.