A musty smell in the basement probably means that mold is growing there. Mold is almost always the cause of musty odors. If you want the musty odor to go away for good, you may at some point have to try to remove the mold. Before attempting mold removal, which can be difficult work, you might want to consider letting your basement our air out as much as possible to see if that doesn't take away the musty odor. Keeping your basement well ventilated and dry is one of the best ways to prevent mold growth, and if your basement is both ventilated and dry, the mold that exists there likely won't spread and multiply as easily.
If you have a musty smell in the basement and the area is often closed off completely from outside air, the musty smell probably resulted from mold growth due to too much moisture in the air. Basements also frequently leak when it rains, which could also contribute to mold growth. If you have basement windows, you can leave those open for several days to let the basement air out. Be sure to close them back up if the weather forecast for your area is calling for rain. You might also want to check around the outside of your basement foundation to see if there are any cracks that water could seep through and patch those up if possible.
Sometimes a musty smell in the basement cannot be eliminated by simply improving the basement conditions. If the mold is very out of control, you might have to begin the process of mold removal to take care of the musty odor. Finding the mold can be tricky, but the best places to look are most likely on the walls of your foundation, on the floor joists of your house, and on pipes and electrical wires. You can use either soap and water or vinegar and water to scrub the mold you find off. There are also products available for mold removal that are slightly stronger, but you should be careful to make sure the basement is well ventilated before using these products because they often contain toxic chemicals.
In the event that airing out your basement, fixing leaks, and removing mold doesn't fix the musty smell in the basement, you will probably have to call in a professional mold-removing service to help you. There is a good chance that you have mold growing in a location that you cannot directly access, and people who are skilled in mold removal will most likely know what places to check for mold and may also have stronger products on hand to remove any mold they find.