What's a rock like granite really made of?
It turns out that granite is a mix of two minerals, quartz and feldspar. You can see the individual specs of each if you look closely.
So what are quartz and feldspar made of?
Quartz is made of a silicon atom and two oxygen atoms (SiO2) arranged in a particular repeating pattern. Note that not all SiO2 is quartz; if the silicon and oxygens got arranged in a different (more compact) way, you'd have gotten Stishovite instead .
Feldspar is actually a group with lots of minerals, including anorthite (CaAl2Si2O8) and albite (NaAlSi3O8) and k-spar (KAlSi3O8) . In general feldspars have lots of silicon and oxygen and aluminum, along with some potassium or sodium or calcium.
So (igneous) rocks are made of specs of minerals, like feldspar and quartz, and those minerals are made mostly of silicon and oxygen, with some aluminum, calcium, sodium, and potassium mixed in. That's mostly it; these six elements account for more than 90 percent of earth's crust by weight.
Why do we have so much silicon, calcium, and aluminum on Earth instead of, say, carbon and sulfur?
Planets are generally made of stuff that can condense into liquids or solids at their temperatures; anything gaseous eventually escapes. That's why Neptune has lots of methane (and therefore carbon), but Earth does not; methane is a solid on Neptune but a gas on Earth.
It turns out that the compounds like SiO2, CaO, and Al2O3 are very stable, and condense even at Earth's temperatures.
And that's why Earth's rocks have so much silicon, aluminum, and calcium: when the Earth formed, these elements were able to form compounds with oxygen and then condense at our relatively high temperatures.
: If the rock forms under more pressure, entropy maximization (equivalent to Gibbs free energy minimization) will cause nature to prefer the more compact formation.
: Minerals are generally defined by a (chemical composition, crystal structure) pair, so each of these has a particular molecular arrangement associated with it.