The swim bladder is the organ of depth control, and acts similarly to the ballast tanks of a submarine, but instead of being filled with water, a gas developed in the fish is the medium of altering buoyancy.
It’ll be appreciated that in the delicately balanced bladder of a fish, the gas pressure should be precisely correct, if it is to swim freely where-ever it desires. If there’s too small gas it’ll sink, and with too a lot it stays on the surface.
Gases which form internally via other causes, like indigestion, occasionally have a temporary effect, but any prolonged upset will certainly be a defective swim bladder, which regrettably is generally incurable.