Well I mean the body is in the water, it's just nearer the surface. Staying close to the surface while swimming has very little to do with the air in your lungs (good swimmers can still be near surface if they want even when they're breathing out and their lungs are ''empty'') and has much more to do with technique, specifically arm and leg action. The slower you swim the more likely it is your lower trunk and legs will sink as you're not generating enough momentum to keep them afloat (although again I would say this is more relevant to beginners because experienced swimmers can deliberately swim very slowly and still stay close to surface). Honestly, staying afloat is similar to balancing and it's just something you get better at over time, it's very common for beginners to sink or not be able to maintain their whole body length near the surface, and I remember you're starting from scratch so I would say don't worry too much about it now. As your technique gets better and you become a stronger swimmer you will naturally find yourself sinking less and less. I've been swimming all my life and I don't remember ever being taught specifically how to stop my body from sinking while swimming, it's just something that happens less the better you get.
In terms of keeping head above water while swimming, this is mainly dependent on upper body strength and very powerful leg action, not on air in lungs.