The Sun and other main-sequence stars are produced by the initial gravitational collapse of a molecular cloud.
Stars like the Sun and others in their main sequence stage arise from the initial gravitational contraction of a molecular cloud.