There are no definitive answers to these and other questions, but there are some theories about the beginning and the evolution of the universe, which consists of galaxies, stars and planets. One such theory is commonly known as the big bang theory. The essence of this theory is as follows:
At the first instance, energy and the quarks existed under a unified force field. When it was cooled, protons, neutrons, electrons and four force fields began to emerge. When it further expanded and cooled, atoms began to form, and condensation of them spawned galaxies, stars, planets and life.
The theory comes from various studies, including modern telescopes on the ground and in space that detect the light from galaxies billions of light-years away, showing us what the universe looked like when it was young. Particle accelerators probe the basic physics of the high-energy environment of the early universe. Satellites detect the cosmic background radiation left over from the early stages of expansion, providing an image of the universe on the largest scales we can observe.
Some important contributors to this theory are: Albert Einstein, whose theory of relativity set the stage for the exploration.
Alexander A. Friedmann realized that Einstein's universe is unstable. The slightest perturbation would cause it to expand or contract.
Vesto M. Slipher of Lowell Observatory was collecting the first evidence that galaxies are actually moving apart. Then, in 1929, the eminent astronomer Edwin P. Hubble showed that the rate a galaxy is moving away from us is roughly proportional to its distance from us.
Hubble's measurements indicated that the redshift of a distant galaxy is greater than that of one closer to Earth. This relation, now known as Hubble's law, is just what one would expect in a uniformly expanding universe.
Fred Hoyle, an English cosmologist, called this process the big bang.
A general description of the big bang theory appeared in Scientific American entitled The Evolution of the Universe by P. James E. Peebles, David N. Schramm, Edwin L. Turner and Richard G. Kron.