Stars are basically nuclear reactors that use hydrogen as a fuel. During its main sequence a star will release energy by converting hydrogen and helium (light elements) into heavier elements and this is why the universe now contains a number of heavier elements.