In a main sequence star the gravity of the core is balanced by the outward pressure of the heat created by fusion of hydrogen atoms, maing it stable. So when the hydrogen is used up, does the star expeand to form a red giant because the outward pressure?
Yes, a star becomes a red giant because of outward pressure increasing to the point when it is again in balance with gravity.
When a star less than 8 solar masses runs out of Hydrogen in its core, the balance between outward pressure and gravity is lost. The core then starts to collapse.
The collapsing core pulls in Hydrogen from outer layers. This then becomes hot enough to start Hydrogen fusion in the layer around the core.
The pressure from the fusion in the core layer causes the star to expand massively into a red giant.