If multi celled animals on the fictional planet evolved in very shallow water, or could only live very close to the surface of water, they might evolve lungs instead of or along with gills.
Most boney and ray-finned fish have organs called gas bladders or swim bladders which are quite similar to lungs.
Which came first, the lung or the swim bladder?
On first thought most people might assume that lungs evolved from swim bladders.
As lobe finned fish were adapting to live in partial water or on land, 420 million years ago during the Devonian, they seem to have split off into multiple groups. Two such branches are known to survive to the present day, the coelacanths and the lungfish.
It's worth note that, despite the name "lungfish", fish evolved lungs before lungfish, or even lobe-finned fish. The common ancestor of lobe-finned and ray-finned fish had lungs, but in most surviving branches of ray-finned fish these evolved into swim bladders used for floatation, instead of breathing. Some, like the bichirs, do retain their lungs, and several other traits that appear to have been common to lobe-finned and ray-finned fish.
While the coelacanth shares many traits with reptiles, the lungfish shares specific other traits with amphibians that the coelacanth does not have. Both coelacanths and lungfishes share the category sarcopterygian with the tetrapods, which includes land animals like reptiles, amphibians, birds, and mammals, e.g. humans. Evidence suggests that the tetrapods are related more closely to lungfish than to coelacanths.
Swim bladders are evolutionarily closely related (i.e., homologous) to lungs. Traditional wisdom has long held that the first lungs, simple sacs connected to the gut that allowed the organism to gulp air under oxygen-poor conditions, evolved into the lungs of today's terrestrial vertebrates and some fish (e.g., lungfish, gar, and bichir) and into the swim bladders of the ray-finned fish. In 1997, Farmer proposed that lungs evolved to supply the heart with oxygen. In fish, blood circulates from the gills to the skeletal muscle, and only then to the heart. During intense exercise, the oxygen in the blood gets used by the skeletal muscle before the blood reaches the heart. Primitive lungs gave an advantage by supplying the heart with oxygenated blood via the cardiac shunt. This theory is robustly supported by the fossil record, the ecology of extant air-breathing fishes, and the physiology of extant fishes. In embryonal development, both lung and swim bladder originate as an outpocketing from the gut; in the case of swim bladders, this connection to the gut continues to exist as the pneumatic duct in the more "primitive" ray-finned fish, and is lost in some of the more derived teleost orders. There are no animals which have both lungs and a swim bladder.
The cartilaginous fish (e.g., sharks and rays) split from the other fishes about 420 million years ago, and lack both lungs and swim bladders, suggesting that these structures evolved after that split. Correspondingly, these fish also have both heterocercal and stiff, wing-like pectoral fins which provide the necessary lift needed due to the lack of swim bladders. Teleost fish with swim bladders have neutral buoyancy, and have no need for this lift.
So lungs and swim bladders seem to have evolved from the same source, or possibly swim bladders evolved from lungs and most earlier fish had lungs. There was an era when most fish species had both gills and lungs.
Fish that evolved lungs would obviously live near the surface of fresh or salt water, where they could reach the surface to gulp air easily.
The deeper the water is, the greater is its pressure. Deep water organisms evolved with internal pressure equal to the external water pressure, to avoid being crushed. So when deep water organisms are caught and raised toward the surface, the lower water pressure causes them to swell up and die.
Lifeforms which live too deep cannot survive reaching the surface, so lungs enabling them to breath surface air would be useless to them. So fish with swim bladders instead of lungs must have had ancestors which evolved swim bladders in deep water. The function of swim bladders is to regulate the bouyancy of fish, to make it easier to stay in their proper depths, and so avoid going to deep and being crushed or going to high and and swelling up.
In a diffferent world where all bodies of water are shallow, fish equivalents with both gills and lungs would probably not evolve to transform their lungs into swim bladders.
Crustaceans, molluscs, and some aquatic insects have tufted gills or plate-like structures on the surfaces of their bodies. Gills of various types and designs, simple or more elaborate, have evolved independently in the past, even among the same class of animals. The segments of polychaete worms bear parapodia many of which carry gills.3 Sponges lack specialised respiratory structures, and the whole of the animal acts as a gill as water is drawn through its spongy structure.
So either various gropus of animals evolved gills independently at different times, or else the ancestors of fish had gills for many millions of years before fish evolved lungs.
So a planet where lungs evolved first would have to be one where all the multicelled aquatic lifeforms lived very close to the surface of the water, where reaching the surface to breath would be very easy, and there would be no advantage to having gills.
This would proably have to happen in very thin sheets of water, especially if tides or waves often left the organisms on land and they had to struggle back to the water.
Posssibly the shallow bodies of water contained substances which were highly opaque to the light frequencies necessary for photosynthesis, so the one celled photosynthisizing organism which were at the base of the food chain, and the organisms which fed on them, and the organisms feeding on them, and so on, were all concentrated at the surface of the water.
When life first evolved on Earth the Moon was much closer and tides were much larger, though multicelled organisms with lungs and/or gills didn't evolve until photosynthesis produced large amounts of oxygen billions of years later.
And possibly such organisms might spread to deeper water, but most would stay near the surface and not evolve gills or lose their lungs.