Z Crystals are used to turn regular moves into Z type moves.
To get Z Crystals, you have to complete a Trial in Alola. You can find more info about Trials here.
A Z move is a regular move – powered with a Z Crystal. A Z Move will make the move stronger and be 100% accuracy (always hit) when used for the first time in a battle. If you use it more than once then the move will not have any of the Z Crystal effect – do regular damage and use regular accuracy.
Once you get a Z Crystal !use the Pokemon you want to power up a move for and do !zmove, the bot will display a list of the moves you have a Z Crystal for and can power up. To power up a move and use a Z Crystal, do !zmove [Move Number] – (move number from the !zmove list) and your move should be powered up with a Z Crystal. You can see the new damage and accuracy by typing !moves