could be that you leave them in the machine a bit too long after the cycle has finished - they will go musty quite quickly
or
that if you hang them on and airer, you are putting them too near the oven to dry - my mum does this and every time she opens the oven, all the clothes get a blast of food smell which seems to stay on the clothes
or
the drainage of your machine is full of gunk and has gone 'off'
or
the the door seal is full of gunk and has gone 'off'
or if you put things in the dryer while they are still very damp, some elastic in the materials can start to be affected by the heat and smell odd.