If your water tastes like dirt but smells fine, it’s almost always a harmless aesthetic issue. Run the tap, chill the water, or filter it. Problem solved.
But if it tastes like dirt and smells like rotten eggs (sulfur) or bleach, stop drinking and call your utility company. You might need a professional flush of your pipes. No shame in that.
One time, I thought my water tasted like mud, but it was actually the new plastic cup I bought. Lesson: Wash your cups, people. Plastic can taste like a landfill.