According to current scientific theory, how did the solar system’s Sun form?

A. Hydrogen and Helium collapsed into a ball under electromagnetic forces.
B. Hydrogen and Helium atoms continually collided and stuck together to eventually become the Sun.
C. The supernova of another sun broke off a large chunk of material which became the Sun.
D. Gas and dust from a rotating nebula contracted under gravitational forces.