It’s true that if you want to burn anything on Earth, you’ll need oxygen. The Sun, on the other hand, is unique. It does not produce the same type of flame that a candle would produce on Earth.
The combustion process is a chemical reaction that occurs exclusively in the presence of oxygen, in which the carbon atom from the fuel links with oxygen in the air to produce carbon dioxide and carbon monoxide. Water is formed when hydrogen and oxygen mix. The combustion process releases energy, which is manifested as heat.
However, the sun’s burning is a nuclear fusion, not a chemical combustion. The sun is seen as a massive hydrogen bomb. The nuclei of the atoms fused together to produce a bigger nucleus via nuclear fusion. Nuclear fusion does not need the presence of oxygen.
In nuclear fusion, there are two major forces at work. The electromagnetic force and the strong nuclear force are these two forces. Between positive charge nuclei, the repulsive electromagnetic force is modest, but the attracting strong nuclear attraction is substantial.
The repulsive electromagnetic force prevails while the two nuclei are far apart. As the nuclei draw closer together, the repulsive electromagnetic repulsion grows greater, making it difficult to push the nuclei together. The attractive short range nuclear force prevails when the two nuclei grow closer to each other, and the nuclei unite to create a new nucleus. As a result, pushing nuclei close enough to fuse together requires a lot of pressure.
Because lighter elements like hydrogen and helium have a low electric charge, they have less electromagnetic repulsion. Fusion occurs in stars when hydrogen fuses with itself or with other luminous elements. The pressure required to spark nuclear fusion in stars is provided by gravity. Because gravity requires mass, burning a star necessitates a large amount of hydrogen.
https://bowie1983book.com/ will answer if there is no oxygen in space how does the sun burn