Over time, an unpleasant smell develops in the washing machine. It sometimes even adheres to washed clothes. There are two reasons due to which this occurs. One is the leftover soapy residue & gunk buildup & the second reason is not allowing the washing unit to air dry. Therefore, rinse your washing machine thoroughly after you finish doing laundry.
You can also do a high-temperature vacuum wash with vinegar or baking soda to eliminate bacteria. It will remove all the unpleasant odors from the washing machine. Also, keep the washer lid or window open between laundry rounds or after you have finished.