Resources are the currencies used to purchase and upgrade assets. The game has four different resources; gold, elixir, dark elixir, and gems.Gold, elixir and dark elixir all have buildings that are used for storing and generating them.
Gold is a resource that is dug up by gold mines. Once collected it is stored in your gold storages. The amount of gold you have is displayed at the top right side of the screen. Gold is used to build and upgrade defensive buildings, traps, elixir collectors, elixir storages and walls. It is also used to place national flag decorations.
Elixir is a resource that is collected by elixir collectors. Once collected it is stored in your elixir storages. The amount of elixir you have is displayed at the top right side of the screen under gold. Elixir is used for purchasing and upgrading troops, army buildings, dark elixir storages, dark elixir drills, gold mines and gold storages. It is also used to place many decorations.
Dark Elixir is a resource that is collected by dark elixir drills. Once collected it is stored in your dark elixir storage. The amount of dark elixir you have is displayed at the top right side of the screen under elixir. Dark elixir is used for purchasing and upgrading hero class troops, as well as training and upgrading dark elixir troops.
Gems are a resource primarily gained through in app purchase (IAP). There are other ways to obtain gems, although these methods are rather slow in comparison to purchasing them in the Shop. Small numbers of gems can be obtained by clearing rocks and trees from your village, but this is random and rate of respawn of trees and bushes is quite low. Completing achievements also awards gems. In addition, the top players in the top three clans receive gems from the weekly tournament. Lastly, Supercell occasionally holds competitions on their Facebook page for which they award gems to the winners.
Gems can be used to purchase gold, elixir, dark elixir and builder's huts. They can also be used to speed up upgrades, gold/elixir collection and to finish troop training.
Generally it's a good idea to save your gems for builders huts, as having more builders drastically increases the speed at which you can upgrade your village.