All crystals have a particular molecular arrangement that is called a lattice arrangement. Their molecules (the elemental particles that make up the crystal) are arranged in regular, repeating structures.
Quartz crystals (when I talk about crystals on this site I will be referring to quartz crystals) are made of a combination of silicon and oxygen (silicon dioxide). As the crystal is formed, the molecules are laid down in such a way that there is a spiral of 30 degrees.
This is also the angle at which human DNA spirals and at which the blood flows through your veins and arteries. Is that why we feel such an affinity to quartz? I think so. There is that resonance there, that link.
Silicon itself is what is known as a semi-conductor. That means sometimes it conducts electricity and sometimes it doesn’t. It depends on the energy applied to it.
Quartz has a particular quality known as the Piezoelectric effect. When a force is applied to a piece of quartz, the distortion of the molecules on its surface produces an electric charge. Similarly when an electric current is applied to the crystal it will resonate at a particular frequency. This is how quartz is used in watches. Its regular frequency of resonance means you can build watches that measure that and keep very accurate time as a result.
This same distortion of the molecules can produce light. This is why battered crystals have been found in prehistoric settlements. People used to strike the crystals causing them to emit light. Poor crystals!
So applying vibration to a crystal produces light and electricity, and applying electricity or light produces vibration.