Stuff happens ….
Several times throughout their radiation fish have evolved either lungs or swim bladders as gas-holding structures. Lungs and swim bladders have different ontogenetic origins and can be used either for buoyancy or as an accessory respiratory organ.
Therefore, the presence of air-filled bladders or lungs in different groups of fishes is an example of convergent (repeated) evolution.