Mildew or musty smells in the washer come from the washing machine not being able to dry out completely after use, then being left in a hot and humid environment. Most people think that because you wash your clothes in the washing machine, it doesn't need to be cleaned, when just the opposite is true.
Set the washing machine on the hottest temperature possible. Turn it on and fill it up while leaving the lid open.
Add 1 cup of white vinegar to the wash. There should be no laundry in the washing machine.
Run the washing machine for a full cycle, then open the lid after it drains completely. Leave the lid up until it is dry.
Repeat the process until the musty and mildew odors are completely removed. Continue to leave the lid open when there is no laundry to be washed and only close it when the inside is dry.