Why does my washer smell, and how do I fix it?
Washer odor is almost always biofilm buildup from detergent residue and trapped moisture, most often in the door gasket, drum, or drain-pump filter. A monthly hot-water clean cycle, weekly gasket wipe-down, and quarterly drain-filter cleaning eliminates it in most cases.
The most common smell sources, in order: (1) the front-load door gasket (mold in the folds — the #1 culprit by a wide margin), (2) the drum itself (biofilm), (3) the drain-pump filter (trapped debris behind a small access door at the bottom-front of front-loaders), (4) the supply hose or drain line (standing water).
Gasket cleaning: pull back every fold of the rubber door boot and wipe with a 50/50 vinegar-water solution or a dedicated washer cleaner. Repeat weekly for the first month to fully reset. Shine a flashlight into the fold — you'll see the mold when it's there.
Drain-pump filter: most front-loaders have a removable filter behind a small panel at the bottom front of the machine (LG, Samsung, Whirlpool, Electrolux — they all have it). Pull the filter every quarter and clean out the coins, hair ties, and accumulated grime. Have a shallow tray ready — water will come out.
If odor persists after all three interventions, it's likely a drain-line issue. Most home plumbing codes require a 2-inch standpipe with a P-trap; if the trap has dried out or the line has biofilm of its own, odor migrates back up. That's a plumber call, not an appliance call.
Manufacturer resources
Official support pages for brands commonly referenced in this answer.