A gem is essentially a precious, potentialy priceless/irreplaceable object.
When referring to a person, it has a similar meaning.
see: AskOxford: gem
1 a precious or semi-precious stone, especially one that has been cut and polished.
2 an outstanding person or thing.
— ORIGIN Latin gemma ‘bud, jewel’.
Hope this helps