A musty smell coming from your crawl space could be a sign of mold or mildew growing inside, generally resulting from high humidity levels. Humidity sneaks in through the walls, beneath your crawl space, and any cracks, holes or openings in the crawl space. Also, the dirt and grime that build up inside don't help matters. Getting rid of humidity and mold will get that musty smell out, and taking measures to further prevent humidity will keep it from coming back.
Make sure there are no holes through which surface water might be entering your crawl space. Moisture can create mold and mildew, which can in turn cause bad smells. Waterproofing your crawl space can make a big difference.
Ventilate your crawl space. Proper air circulation will help get rid of the stagnant or musty air.
Get some porous bags of crushed lava rocks and place the bags at different levels of the crawl space. According to the Lee Valley website, the lava rock will work like super baking soda, absorbing and neutralizing odors in your crawl space.
Use sprays such as Oust to temporarily eliminate the odors while you're inside the crawl space working to prevent mold and mildew and get rid of the smell. It will make the job more bearable.
Clean the crawl space thoroughly to help get rid of the immediate smell. Along with mold and mildew, dirt and dust will build up, which also can contribute to the musty smell.
Install a vapor barrier inside the crawl space to reduce moisture inside it. A vapor barrier is a plastic tarp, usually at least 6 mil thick. It is laid across the ground of the crawl space, where it helps prevent moisture from the ground from rising into the crawlspace. Vapor barriers are simple and easy to install. Eliminating humidity will stop the spread of mold and mildew and help get rid of that musty smell.