Stars are giant balls of hot gas that generate their own light and heat through nuclear fusion. This process, occurring in the Sun's core, releases tremendous energy, making the Sun appear bright and warm.
It's important to distinguish between stars and planets. Planets, like Earth, don't generate their own light. They reflect light from nearby stars, like the Sun.