The swim bladder in the fish is an organ which allows the fish to control its buoyancy. The swim bladder contains air which allows the fish to float. The fish can control the amount of air in the swim bladder. Air is absorbed from or released into the bloodstream.
If the fish wants to sink, it absorbs the air from the bladder into the blood, the swim bladder shrinks in size and the fish sinks. If the fish wants to rise, it releases air into the swim bladder and the fish rises.
Some fishes such as sharks and rays do not have a swim bladder. They control their buoyancy by swimming and generating lift with their fins.
Bottom dwelling fish also do not have swim bladders.