I'll try to explain it as briefly as I can, but please realize that I'm oversimplifying it quite a bit.
It started, of course, with the Big Bang. Now, the infamous "Big Bang Theory", as it is somewhat inaccurately known to laymen, only attempts to explain what happened immediately AFTER the event in question. Our current mathematical models can only reliably explain what happened back to about one hundred billionths of a second (1 x 10^-11 seconds, 1/100,000,000,000 seconds) after the event. Before that point, most models start to give meaningless answers, because of the extremes involved.
Some models show that at about 1 x 10^-37 seconds after the Big Bang, the Universe was filled pretty homogeneously with a type of high energy plasma. This plasma, called a quark-gluon plasma, consisted of free quarks and gluons, which are the building blocks of protons and such. At about 1 x 10^-6 seconds after the Big Bang, the plasma had expanded and cooled enough to allow the quarks and gluons to form baryons (protons, etc).
At about 1 second after the Big Bang, the temperature was already "only" about 1 x 10^9 K (a billion degrees Kelvin, 1.8 billion degrees F), which was cool enough (yet hot enough) for a process called Big Bang (or "primordial") nucleosynthesis to occur. This basically means that the free protons and neutrons were able to fuse into the atomic nuclei. Most remained single protons, but some became deuterium or helium, and rarely lithium and a few others.
It took another 379,000 years of expansion and cooling before the free electrons were able to pair with the free protons and nuclei to form atoms. About 75% of the atoms were Hydrogen, about 25% were Helium, and everything else was only present in trace amounts. (Even today, the Universe is about 74% Hydrogen, 24% Helium.) Atoms aren't able to absorb nearly as much energy as free particles and the extra became what is known as the cosmic microwave background radiation.
Due to gravity, slight differences in density began to form large gas (well, still technically plasma), which then formed quasars and stars. These first stars started showing up after about 150 million years. A star is basically just a cloud of mostly hydrogen and helium that became so dense that the temperature rose enough to start a fusion reaction. The Hydrogen and Helium atoms fuse together into heavier elements, which are fused again and again.
All of the heavy elements (again, basically everything besides Hydrogen, Helium and a few traces of other things) were created in stars. Most of the material is ejected into space in supernovae, which then eventually mixes in with other gas clouds. Those clouds then form solar systems, with most of the lighter elements being pulled "quickly" into the the center to become the star and the heavier elements clumping together a bit slower to form planets.