I think the way it works for most most (maybe even all) insects is to use air to blow themselves up much like a balloon to get out of the egg or cocoon.
Also initially the insect might break the egg/cocoon open without extra air, just by simple mechanics, but once it's out it starts to pump air into itself.