When you put the pen
top in the water, a bubble of air
is trapped inside it. This
trapped air bubble makes the diver
less dense than water, so it floats.
When you squeeze the
bottle, water squashes the air and
takes up more space in the pen top.
Now the diver is denser than
water, so it sinks.
When you relax your
grip on the bottle, the air in the
pen top expands again. Now
the diver is less dense than water,
so it comes back up to the surface.