To get started you need 2 things:
Some Blank Z-Crystals
A Z-Ring
Once you have the Z-Ring you need to right-click in the Air to enable using Z-Moves.
Once you do that you will have a button for Z-Moves in your Battle GUI when a Pokémon is holding a Z-Crystal that can use a Z-Move.
Z-Crystals are obtained by right-clicking certain Blocks/Entities with a Blank Z-Crystal.
The Z-Crystal will be consumed, and you will get a Z-Crystal
Made by crafting a Blank Z-Crystal with nothing in a shapeless recipe
Made by right-clicking a Bamboo Block with a Blank Z-Crystal
Made by right-clicking a Magma Block with a Blank Z-Crystal
Made by right-clicking a Wet Sponge with a Blank Z-Crystal
Made by right-clicking a Copper Block with a Blank Z-Crystal
Made by right-clicking a Wheat Crop with a Blank Z-Crystal
Made by right-clicking Powder Snow with a Blank Z-Crystal
Made by right-clicking Bedrock with a Blank Z-Crystal
Made by right-clicking an Iron Golem with a Blank Z-Crystal
Made by right-clicking a Cave Spider with a Blank Z-Crystal (Every Mode except Peaceful)
Made by right-clicking Soul Sand with a Blank Z-Crystal
Made by right-clicking Reinforced Deepslate with a Blank Z-Crystal
Made by right-clicking a Vex with a Blank Z-Crystal
Made by right-clicking a Dragon Head with a Blank Z-Crystal
Made by right-clicking a Beehive with a Blank Z-Crystal
Made by right-clicking an End Gateway with a Blank Z-Crystal
Made by right-clicking a Mud Block with a Blank Z-Crystal
Made by right-clicking a Chicken with a Blank Z-Crystal
(currently bugged)
Made by right-clicking an Alolan Raichu with an Electrium Z
Made by right-clicking a Decidueye with a Grassium Z
Made by right-clicking an Incineroar with a Firium Z
Made by right-clicking a Primarina with a Waterium Z
Made by right-clicking a Pikachu with an Electrium Z
Made by right-clicking a Hat Pikachu with an Electrium Z
Made by right-clicking any Tapu with a Fairium Z
Made by right-clicking a Marshadow with a Ghostium Z
Made by right-clicking a Mimikyu with a Ghostium Z
Made by right-clicking a Lycanroc with a Rockium Z
Made by right-clicking a Kommo-o with a Dragonium Z
Made by right-clicking a Solgaleo with a Psychium Z
Made by right-clicking a Lunala with a Psychium Z
Made by right-clicking a Necrozma with a Psychium Z (Currently not working in battle)
Made by right-clicking an Eevee with a Normalium Z
Made by right-clicking a Mew with a Psychium Z
Made by right-clicking a Snorlax with a Normalium Z