You have to balance the amount of air and the amount of water to get it so that the heaviness of the glass counteracts the push of the air wishing to escape - so you can effectively trap the air under the water in the glass. You'll notice that the glass has some pressure pushing up on it because the air wants to escape. The trick is negative buoyancy so you can actually carry the boat upside down UNDER the water and still have air to breathe.
Yes, take a simple drinking glass and push it opening down into the water, you will see that the air gets trapped in the glass and if you were a tiny man standing under that glass (or a swimmer who can swim into it) the air would be there for you to breathe.