How to Clean a Smelly Washing Machine...Clean the washer's lint trap with every load. (I didn't even know my washer had a lint trap!) Run a hot cycle WITHOUT clothes, add 3 cups distilled white vinegar to the cycle to clean out any bacteria. To keep the musty smell from coming back, occasionally add 1 cup vinegar to a load of towels. Also, run an occasional chlorine bleach load w/ hot water to keep musty smells at bay. Do it once a week w/ a load of whites.
Clean your HE washer AND --> "...here’s a little trick I used to get the stinky smell out of the clean clothes without having to re-wash three loads of ”clean” laundry. I took a wash cloth and sprinkled a few drops of tea tree essential oil on it and threw it in the dryer with a load of clothes. Took the smell right out."