I wipe down the inside rubber gasket of my washer thoroughly dry immediately after each use with a cotton towel to prevent mold, mildew, and smells. If you do not, bacteria and mold will grow.
This page contains the following solutions.
Turn machine on, fill with warm water (full load level) and add a bit more than 1/2 gallon of the cheapest vinegar available. Let the machine finish its cycle.
Frequently musty odors are associated with front loading washers, however a top loading model can also develop a musty smell. This is a page about top loading washer smells musty.
Is LA's totally awesome all purpose concentrate cleaner degreaser spot remover able to clean the washer for odd smells too? I have to get a funky stinky smell out of the washer before I can't wash my clothes anymore! It's getting ''''nasty!