Why do goldfish come up for breaths?

If a goldfish is gasping for air at the surface, it's usually a water quality issue. Test for ammonia (it should be zero), nitrites (zero), and nitrates (10ppm or less), and also your PH (7.4 to 7.6 is best).

If your numbers are different, you should try a large water change of at least 75% to help clear the water of harmful toxins, and quite likely help with the PH level. Remember to match the temperature of the new water to the old water, and to add in the recommended dosage of water conditioner per the instructions on the bottle.
This is a process that you should be doing at least every week, but more if your tank is overstocked.