In the case of the sun, the heat from the core causes the solar matter at the bottom of the sun to become less dense than the solar matter at the top. This causes the hot solar matter to rise, and the cooler solar matter to sink. This creates a convection current, which continues until the solar matter reaches the surface of the sun.
The convection of solar matter is an important part of the sun's energy production. The convection currents carry heat from the core of the sun to the surface, where it is radiated into space.