What luxury do other athletes have that swimmers do not? Freedom to breathe whenever they want. Many athletes can breathe hard with no concern about the limitations of their supply, while swimmers are constantly cautious of this. If a swimmer tries to breathe whenever or inhales too aggressively, they may end up breathing in just as much water as air. The result is usually an immediate stance followed by a cough. If you feel like this is happening often, perhaps it's more than your technique that needs adjusting, but rather your timing.
The obvious mistake: When I began competitive swimming I struggled to keep up with my peers in freestyle. I was not as conditioned as some of them were, but I could not seem to keep up speed or distance without being completely out of breath every time. My coach told me I was not breathing, but I knew I was. Well, I thought I was. Breathing is not inhaling air, it is the process of breathing in oxygen (and its other components) and exhaling Carbon Dioxide. What was happening was, I would wait to exhale after turning my head out of the water, and attempt to breathe in as fast as I could without swallowing water. The result was, I felt panicked for air and would swim erratically. I was exhaling more than inhaling. My coach had me exhale through the length of my head being submerged, and only inhale when my head was above the surface. This sounds like a really obvious mistake, but it is very common for swimmers to do this, even in upper level swimming.
Too Much or Too Little?
The compensation mistake: It is easy to over or under-compensate the amount of air we need in our strokes. A regular case, students breathing every chance they get. This is often most observable in freestyle. Common practice is to alternate the direction of your head every three strokes. What happens is students breathe every stroke or every two strokes instead. The result is similar to those getting the wind knocked out of them. They may be breathing in, but they feel as if they are not getting anything at all. The issue is their lungs are full and while they may be letting out small amounts of air, they are continuously trying to breathe more air in with full lungs. With lungs at capacity, the air inside has turned to Carbon Dioxide and the body feels like it is suffocating. The swing of this is to wait too long. Someone may be exhaling but they do not inhale until their sixth or eighth stroke. The result is a long and profuse inhale when surfacing. This pulls in more water and can cause the swimmer to cough immediately.
At no point should you feel like you are suffocating, regardless of the stroke, distance or speed. A way to improve this, try exhaling all your air in the amount of time it takes before you need to resurface. For freestyle, try to exhale all air within the span of three pulls. Then move down to two pulls. Finally, take your time between pulls and allow all the air to be purged before surfacing. As you breathe in, do this slowly. Breathe in a way that feels normal and regulated not rushed. For breaststroke, hold your glide until you have full purged your lungs, then repeat your stroke.
Let your breathing take over instead of trying to fit it into your stroke. If your breathing sets the pace first, your performance will feel more natural, even, and more comfortable at various speeds or distance.