The smell means they didn't fully dry, not that they're dirty.
Why Your Towels Smell Even Though They're Clean
How to wash towels and bath mats so they don't get that musty smell.

A towel can go through the wash and still come out smelling musty. That's frustrating, because it feels like the wash didn't work.
Usually it did. The smell is almost always about drying, not washing.
Don't overload the washer

Wash towels in a load that isn't packed tight. Leave enough room for water to move through them.
Why? Towels need to tumble freely to rinse the soap out completely. A packed load leaves soap residue behind, which is what starts to smell.
Skip the fabric softener

Use regular detergent, and skip liquid fabric softener on towels.
Why? Fabric softener coats the fibers with a waxy layer that actually makes towels less absorbent, and that coating holds onto moisture and odor.
Wash on warm, not always hot
Wash towels on a warm setting most of the time. Save hot water for when they need real disinfecting, like after an illness.
Why? Hot water breaks down towel fibers faster over time. Warm water cleans well for regular use without wearing them out as quickly.
Dry them completely

Dry towels on a normal or high heat setting until they're completely dry, not just dry to the touch on the outside.
Why? Any leftover dampness in the thick part of a towel is exactly where mildew starts. Full drying is what actually prevents the smell, more than any detergent.
Hang bath mats to dry between uses

Hang a bath mat up after each use instead of leaving it flat on the floor.
Why? A mat lying flat traps moisture underneath against the floor, which is exactly the same problem as a towel that doesn't fully dry.
If today's a lighter day
Just hang the bath mat up after your shower. That's enough for now.
It was never about dirt
The smell was never about being dirty. It was about staying damp. Once towels and mats get a real chance to dry, the smell doesn't come back.

Dry, not just clean. That's what keeps them fresh.
