I’m not great at physics and have no knowledge of aeronautics, so this whole chain of reasoning might be wrong.
A plane stays in the air because air is moving over the wings, which generates lift. However, that air is moving because the engine is moving the plane forward. There is no other source of energy. Therefore, some of the engine’s energy is going into keeping the plane in the air, and some is going into accelerating it forwards, or keeping it at the same speed (fighting air resistance).
Therefore, if the plane points straight up, the engine should be able to support it hovering in the air. If it didn’t have enough power to fight gravity when pointing straight up, it wouldn’t have enough power to fight gravity when moving horizontally, either.
(Okay, some older engines only worked in certain orientations, but I don’t think that’s a problem for jet aircraft, or any aircraft built after WWII.)
So why can only certain planes fly vertically?
I too am not knowledgeable about aerodynamic myself but my educated guess is because of efficiency. Moving horizontally , energy is conserved by lift. You would need more energy over longer periods of time to fly vertically which is why planes stall when they try to climb to high to fast. Also the higher up you go the thinner the air meaning you would need combustion to get any higher at some point as there would not be enough air to push to keep you up.