There are 4 possibilities that I can think of at the moment.
1 if you leave the machine off for a long period (several hours/days is there water in the drum? even though you drained out on the last wash? If so,then there are two possible reasons for this.
2, one of the water inlet valves is not fully closing/damaged.
3. The drain hose is fitted incorrectly,and foul water is slowly back-flowing into the machine.
Try and not use liquid detergents,use powder variants.
And leave the drum door open,a little, to allow things to air,nice and fresh.
Phil.D., February 2010