The cause of musty smell in clothes is usually because the clothes have sat too long when damp.
Clothes need to be dried soon after you wash them.
The longer you leave the clothes wet and damp the more the clothes will take on a musty smell.
The water sits in the clothes and then mold begins to form which is a cause of the musty smell.
So make sure you dry your clothes immediately in the dryer or hang the clothes out to dry to get the moisture out of the clothes.
To get the musty smell out of your clothes you can soak them in vinegar and baking soda for a few hours and then wash them like normal.
The vinegar and baking soda usually takes the musty smell out of your clothes.