Gems or gemstones are minerals, which are used for jewelry. Because of their transparency and colour they are used for aesthetic artworks. Because of their rareness they are of some value and sometimes used as a sort of alternative currency.
Gems are divided into two groups, precious or semiprecious gems. Semiprecious minerals have a lower hardness and resistance against acids and other substances, also they are generally more common. So their value is lower. Most semiprecious gems are based on quartz.
Because of their hardness and resistance against acids gems remain when the surrounding rock is dissolved by erosion. You could call them placer deposits. That's why gems are typically mined in soft sands or clays, typically by washing them out. But there are some gemstone mines, which are of some interest.