Gems are a currency in Lego Legacy: Heroes Unboxed.
Availability
Completing Nodes: Every time you complete a node for the first time, you gain 2 Gems.
Leveling Up: Leveling up your account adds gems, albeit only a few.
Daily Quests: Each Daily Quest grants you 5 Gems (with the exception of one) and the daily reward gives you 15 Gems.
Achievements: Most Achievements grant Gems upon completion.
Daily Login: Certain days of the month gift 50 Gems.
Arena Rewards: Arena Rewards grant Gems along with Arena Coins.
Lego Legacy Events: Certain events, such as the Wings of Fury event grant the player gems. Another example is Global Release.
Brick Separators: Using a Brick Separator has a chance to grant 5 Gems.
In-App Purchases: There are certain packs buyable which contain gems whether that be only Gems or with other items.

Uses
Gems are a currency, so they are used to buy multiple items.
Shopping: Gems can be used in the Shop to buy Coins, Bags, Scrolls, Gear, Gear Plans, Gear Bits or Tiles.
Energy Refreshing: Using 50-200 Gems (maxes out at 5) per day, you can refresh 100 yellow or red Energy.
Arena Refreshing: You can battle consecutively without waiting by using 50 Gems.
Node Refreshing: Using 50 Gems, you can refresh a node's time wait after looting it.