It’s been a long time since I’ve used Audacity, but I can speak to what I would do in Logic (a similar if not slightly more robust Digital Audio Workstation DAW). Generally when you hear distortion, it’s a signal clipping (jargon for exceeding the signal strength of the medium). If you think about audio, it’s a wave (think of a sine wave for some intuition). Distortion typically occurs when the troughs and peaks of a wave exceed the allowable range of the medium. This causes the medium to turn your perfectly curved signal to smash into a square. Literally, the peak and trough of the wave gets forced into a square as it’s run out of room the medium can provide and generates a sound that’s generally unpleasant to the listener.
While I’m sure there are many places, the two main places you introduce distortion are on input and in the recording process. On the input, your signal might exceed the limits of the source device (microphone, input jack, sound card, etc), as well as an intermediate device in that signal chain (pre-amp, or some signal processing device). These input devices typically have a signal limit and once exceed, typically will simply truncate your wave to a square when it exceeds input limits. Unless you’re using good quality input devices, it’s entirely possible the act of recording the signal introduced distortion. Even with the best equipment, you can still introduce distortion, it’s just a bit harder as the input devices will typically have higher input ceilings. In this case, you can’t ever really remove the distortion. As it’s baked into the recording itself. You can only take steps to reduce how audible it is. The solutions here would involve what other folks are talking about: trimming volumes (check out ducking and side chaining), applying compression or eq either globally or at certain frequencies at moments of high distortion. You can do this by hand and it’s super tedious. I’m not sure about Audacity, but there are typically plugins for DAWs that will do this semi-automatically and reduce the tedium greatly (Izotope Audio Repair is considered the industry standard for this sort of thing).
You can also use approaches like side chaining, where you copy the track twice. The first track will be heard, the second won’t. But you can use the audio from the second track (particularly when it exceeds some threshold), and apply a volume reduction or compression to the first track. Typically this is used in professional audio and the reason you can always hear a kick drum in a mix which you likely wouldn’t hear if you listened to the music live (aside, the reason you hear a kick drum at a concert is they simply mic and amplify that kick multiple times louder so it’s louder than everything else). In recordings, the kick drum is almost always side chained so the instant the kick drum hits, the volume of most other instruments is lowered momentarily to make space for it.
The second area distortion is most often seen is within the daw. If you take a signal and max out the gain/volume, your signal will clip in the DAW itself. In these cases, the easiest thing to do is turn the volume or gain down and see if that removes the distortion. If it does, you lucked out and have a clean signal. Solving this problem will create a second, your audio will now be too quiet. Fortunately, there are audio engineering tricks around this. Typically, you will run your signal through processing like a limiter or compressor. The compressor will “normalize” the signal by lowering the high volume and raising the low volumes. This will make the audio signal more consistent and allow you to raise the volume again without “clipping”. Alternatively, you may look into a “limiter” which only compresses signals when a signal exceeds a limit. At extreme settings, the compressor and limiter will both make a wave a square and recreate that nasty distortion sound. However, at more moderate settings they will perform a ratio reduction (for example in the case of the limiter, reduce a signal 4 decibels for every decibel over some thresholds), this will, ideally, cause your signal not to hit the “ceiling” and turn square, but not flatten the peaks so much they become “square” due to signal processing either.
Hopefully this was helpful and gave you the tools to get yourself unstuck.