Advice from my wife:
1. if your machine is a front-loader, make sure that the door seal is thoroughly dry when the wash has finished. If water is allowed to remain in the seal, it can give off a stagnant smell.
2. make sure that you wash at the temperature recommended on the clothes' labels. Washing at too low a temperature may not do a thorough job.
3. in between washes, leave the machine door open. Not wide, a little bit will do, to ventilate the drum.
4. in between washes, place one Tesco Summer Fresh tumble dryer sheet in the drum and leave it there to freshen the drum. Remove the sheet before the next wash.
5. is the filter clean?
If none of the above works, an engineer might be required. Best of luck.