A candle gets its flame from combustion, a chemical reaction. The hydrocarbon that formed the candle reacts with oxygen, and we get carbon dioxide, water, and heat energy as the results. The oxygen is obtained from the air. If the air supply is cut off —for example by covering the candle with a glass— then the reaction will stop, and the flame goes out.
We hear flat-Earthers often claimed that it is impossible for the Sun to be in space. They said the Sun burns, and therefore it requires oxygen. Space is empty, so it is impossible for the Sun to be there. They are wrong. The reaction that is occurring in the Sun is not combustion. It works differently from what happens with the candle.
Nuclear fusion powers the Sun. It fuses hydrogen atoms into helium atoms. All the necessary component for the reaction to happen is in the Sun, and the reaction doesn’t require matters from external sources.