The solar system was born from a great cloud of whirling gases. The force of gravity drew the atoms of the gas close together. As the gas condensed into a ball, the circular motion increased. Rings of matter were left spinning around the central mass. These rings of matter condensed to form the planets, and the central ball of gas became the Sun. This is the widely accepted Nebular Theory.
Another theory is that, a star either passed close to the Sun, or collided with it. This tore a great system of material from the sun, and sent it spinning around. Some of this material was moving too fast to fall back into the Sun. It came together to form the planets. This is the Planetesimal Theory.
Theories like the Tidal Theory and Protoplanet Theory also explain the origin of the solar system in different ways.