What do you use?
I began washing with Tide regularly for the eheavy duty loads and only have to use additional commercial items from time to time. When I do have to use them, I add a little mint oil cleaner to the wash. Lysol, Pine-sol or any other type of pine or lemon cleaner would work just as well. I like the mint oil one or the pine oil from the same company myself as it has more natural ingredients and is locally made.
I suspect it is a combination of things. In the summer, it's not uncommon for my husband to come home with sweat drenched clothes. They will have a very sour odor with musty undertones. I think his body chemistry and possibly the clothes remaining damp are the culprits.
I was having an issue with towels at one point. After washing them, they would smell musty. I typically use about a quarter of the detergent called for and moved it up to half or so. I added baking soda to the wash cycle and then used Downy in the rinse. I machine dried instead of hanging them. I did this for only three washes maybe. I have been using my usual amount of detergent and line drying since. I am completely baffled at this.