Like the sun, what happens inside the sun is nuclear fusion.
The initial high temperature of the sun comes from its internal pressure. According to the principle of universal gravitation, the greater the mass of an object, the greater the gravity. In the early years, when the sun snowballed, with the increase of mass, the gravity was stronger, and the more substances attracted around it, the more the mass increased, and so on, the mass of the sun became bigger and bigger. At the same time, the greater the mass, the greater the internal pressure, so that the temperature continues to rise. The conditions of thermonuclear fusion are sufficient pressure (called critical pressure) and suitable ignition temperature. With the increasing mass of Taiyang Yuan and the increase of internal pressure and temperature, the sun began to glow and become a star after meeting the thermonuclear reaction conditions. Generally speaking, a gas planet must have a certain mass in order to become a star, so that its internal pressure and temperature can meet the conditions of thermonuclear reaction. This mass is called critical mass. A typical example is Jupiter, the largest gaseous planet in our solar system, which is also a gaseous planet composed of hydrogen. However, because its mass is less than the critical mass, its internal pressure and temperature cannot meet the conditions of thermonuclear fusion, it can only be a gaseous planet. However, it is a potential sun. Some scientists speculate that after the destruction of the sun in the future, Jupiter, which is not restricted by the sun, will attract the surrounding planets to form a small solar system by virtue of its position as the boss of the solar system, and at the same time continuously absorb the surrounding substances to increase its mass. After reaching the critical mass, it will shine and become another sun, but that will be 5 billion years later.