I had similar after leaving some semi-dry clothes in the dryer too long. Drying a towel with a bit of white vinegar sprinkled on helped a bit, but putting a couple of Lenor dryer sheets in with some damp clothes cleared it completely.
I found a bag of clothes in the garage and washed them before giving them to charity, as they smelled really musty. They have tainted the washing machine and tumble dryer. I got the smell out of the washer with a machine cleaner and a boil wash on empty, but even though I've aired the dryer and sprayed it with Dettol it still smells so musty that I can't use it, as fresh clothes come out smelling horrible.
Any ideas? It's a fairly new machine and I can't replace it.