By burning, I mean light being produced by burning something, not necessarily gas. For example, some Ancient Greek astronomers thought that the sun was a burning ball of metal.
The belief that the light and heat of the sun are produced by burning is very old. It appears in multiple cultures from multiple continents, and while the origins of such beliefs are lost in prehistoric time, it is probably very, very old. We have reasonably good evidence of the controlled use of fire already by 1,000,000 BP (which is older that Homo sapiens; we're talking Homo erectus here). The sun gives off light and heat, and fire gives off light and heat. Few other things do both (the heat from the moon and stars can't be felt, and many things are hot but don't give off light). Identifying the sun with fire is natural.
These theories of the sun are not always what we would call "scientific" today. For example, the sun is sometimes identified as a torch carried by the sun god, often lit every morning and extinguished at sunset.
There are other old theories of the sun's heat and light. With elemental theories that everything is composed of earth, air, water, and fire (or similar theories), it's natural to suggest that the sun is predominantly made of the fire element (or even purely fire element). This is not the same as saying that the sun produces light and heat via burning. Usually, in theories like this, burning something ("fire", in our conventional modern sense) releases the fire element from the burning substance. The fire element is not something that's burning, but a substance that is released by burning. If the sun is made up of the fire element, it isn't burning.
Related to this is the identification of the sun as a god, giving of heat and light through divine power. Both a fire element theory and a divine theory like this might depict the sun as flaming, but nothing is burning, nothing is being consumed by fire.
There are other things beside fire that can give off fire and heat. Objects that are sufficiently hot glow as well as give off heat. For example, one might postulate that the sun is a glowing ball of hot iron (not burning, but just very hot). Theories like this are old, e.g., the sun as a hot rock, as taught by Anaxagoras in the 5th century BC. They also survived into the modern era, into the early 20th century. Of course, one should explain what heated the hot sun in the first place. Even a simple explanation such as a fire on the ground heats the sun before sunrise (with the early dawn light coming from this fire) provides explanation beyond the sun burning - it explains why the sun just looks like a hot ball, without visible flames, and why the sun isn't burned up. Other old explanations are that the sun is heated by friction as it moves through the sky (heating by friction being familiar, and used for fire-lighting technologies such as fire drills). 19th century versions of the hot object theory proposed (a) the sun was hot when it first formed, and hasn't cooled down yet, (b) the sun is heated by gravitational contraction, and (c) the sun is heated by matter falling into it, These are related - the initial heat of (a) would have come from gravitational contraction or infalling matter; (b) and (c) simply suggest that these processes are still occuring. (b) and (c) both involve matter moving inwards, and are also related. Versions of (a) to (c) were used to estimate the maximum age of the sun, with results varying from thousands of years to millions of years.
The twentieth century added the idea that the heat might be generated by radioactive decay (the source of the earth's internal heat). (a) to (c) above, and radioactive decay are all burning-free theories. In 1920, Eddington identified nuclear fusion of hydrogen to form helium as a possible source of energy. The details were worked out later by Chandrasekhar and Bethe, and we reach our modern understanding. While nuclear fusion is often described as "burning", it isn't burning in the common usage of the word. Our modern view of the sun: it's a hot ball of gas, heated by nuclear fusion. Apart from nuclear fusion as the source of energy, it differs from most older non-fire-element theories where the sun is a hot solid or liquid object.
Reference:
Eddington, A., "The Internal Constitution of the Stars", The Scientific Monthly 11(4) 297-303 (1920). https://www.jstor.org/stable/6491