Quartz is an igneous rock made out of molecules of silicon and oxygen atoms held together in a crystal pattern. All of the silica and oxygen that make quartz came originally from the insides of stars, and it shot out of the stars when the stars exploded as supernovas. Then the silica formed part of a nebula, a dust cloud floating in space.
Nobody knows exactly how the silica got to Earth from the nebula, but once it did, it sank down under the lighter elements of Earth (oxygen, hydrogen, and carbon) but stayed above the heavier elements (mainly iron). So silicon got stuck in the middle - not in the core, but not on the surface either. In this middle zone, it was hot enough to melt rock. Most of the silica on Earth is still in this melted state. Only a little of it has gotten close enough to the surface to cool down and become solid rocks like quartz or granite.
There are many different kinds of quartz, depending on exactly how it cooled down. Some kinds have large crystals, and some have very small crystals. Small amounts of other materials that get into the stone can give it colors - quartz with a little iron in it is a pink color or a purple color called amethyst. Some kinds of quartz are nearly transparent (you can see through them).
When people want quartz today to make things out of, they often make it themselves in hot furnaces, rather than digging it out of the ground. By controlling the process, people can make perfectly even quartz with no irregularities. People use perfect quartz to make digital watches and computer microprocessors. Most glass is made by melting sand made of tiny bits of quartz. People also use quartz crystals in various religious ways.
Quartz also often becomes a part of other kinds of rocks. Some igneous rocks, like granite, have quartz in them. Some sedimentary rocks, like sandstone and limestone, also contain quartz. And some metamorphic rocks, like marble, have quartz in them too.
To find out more about rocks, check out these books from Amazon.com or from your library: