Gills Are Designed for Water
Fish have gills made of thin filaments with a large surface area for gas exchange. As water flows over the gills, oxygen diffuses into the blood and carbon dioxide diffuses out. Air is much less dense than water, so it would not flow effectively over gills, making oxygen absorption highly inefficient.
Lungs Are for Air
Air-breathing animals have lungs with a much larger surface area than gills, capable of extracting oxygen from air, which is more concentrated than in water.
The Problem With Air
Air passes through gills too quickly for sufficient oxygen diffusion. Additionally, delicate gills are designed for a moist environment and would dry out and become damaged in air.
Exceptions
Lungfish have lungs and gills. Mudskippers can breathe through skin and a mouth chamber out of water. Walking catfish can gulp air and hold it in gill chambers. These are exceptions; most fish cannot survive long in air.