When the bottle is squeezed, the air that is in the diver is allowed to compress. This compression of air in the diver makes it more dense than the water around it, so it sinks. When the bottle is released the diver becomes less dense and allows it to rise.