Is it possible for an animal to have isolated air-spaces like a nautilus or man o' war if it also has lungs? The lungs need not be for breathing, but they should be directly connected to some air-collecting orifice. The air-space must be filled with air or gas, but otherwise could be anything plausible
I can think of two ways
1:1 bilateral asymmetry
the animal has one lung and one swim bladder, snakes can work with one lung, as long as you make it beg enough a single functional lung works. whether the pair started as swim bladders or lungs is up to you. basically the lft os one thing and the right is another. organisms already did something similar with the circulatory system to create a four chambered heart.
Your thing evolved from something like birds that have many air sacs as well as lungs, then it turns one set of air sacs into swim bladders. Note such a creature will not have gills, air sacs are a fairly advanced breathing mechanism. Birds haven't become fully aquatic because hard shelled eggs are incompatible with ovoviviparity, so you likely can't use actual birds but there is no reason an alien creature could not evolve it. shelled eggs and air sacs are not linked in any way.
What you are asking is basically a swim bladder in an organism that doesn't necessarily swim.
The swim bladder, gas bladder, fish maw, or air bladder is an internal gas-filled organ [...]. The swim bladder is evolutionarily homologous to the lungs. Charles Darwin remarked upon this in On the Origin of Species. Darwin reasoned that the lung in air-breathing vertebrates had derived from a more primitive swim bladder.
It can be derived from a lung which can be filled or emptied by exchanging gas on request.
There's really no point. Lungs essentially perform the same role as a swim bladder (indeed, they're the same organ in fishes), and lungs originally evolved as a buoyancy organ and only secondarily became used for oxygen exchange. All a lung is is an "isolated air space" that has a moist cutaneous lining for gas exchange.