There are two main elements ( warm & humid environment ) is the perfect formula & breeding ground for Mould/Bacteria,
therefore, the more Mold, the more bad smells comes out from your washing machine.
How to Tackle the Issue?
Empty your Washing Machine and turn it ON empty om the highest temperature mode.
if you still see dirty/mould or smells still bad?
then pour 250ml of white vinegar into empty drum and repeat the above steps.
But please remember to follow the below steps to prevent any future Mould or Bacteria in washing machine:
Fresh Air: always make sure to have a fresh air running in and around the area were you keep your appliances.
Clean: always quick clean the drum after every use.
Detergent: use as less as laundry detergent as possible.