WARNING: Contains Spoilers.
First, you have to get the Zygarde Cube from Dexio and Sina after defeating them in Heahea City. After that, you have to find and collect Zygarde Cells that are scattered across Alola, and take them to a special caravan on Route 16. If you have 10 Zygarde Cells, you will get Zygarde 10% Forme. 50 cells gets you Zygarde 50% Forme, and 100 or more gets you Zygarde Complete Forme. There are also 5 Zygarde Cores that, when combined with the cells, teach Zygarde a certain move. A complete list of all Cell and Core locations can be found here
Hope I was able to help!