First things you'll have to do are:
1.You need to unlock boot loader of your Moto G 3rd gen 2015.
2.You must have proper Motorola Drivers installed in your PC.
3.And ADB fast boot also for flashing TWRP recovery.
Steps to root your phone.
1.Download latest TWRP recovery.
2.Download Motorola USB Drivers.
3.Download Minimal fast boot and install it on desktop.
4.Download latest SuperSUv2.46.zip.
5.Now Unlock your Moto G 3rd gen Boot loader.
6.After unlocking Boot loader of Moto G 3rd gen ,Copy SuperSu.zip in you Device memory that you downloaded above.
7. Now turn OFF your Mobile.
8. Then Turn On it again By holding (Volume down button and power button) at the same time for 6 sec and release it you will again see the boot loader.Now plug you device with your PC.
9.Then copy twrp-osprey-2.8.7-test1.img that you Downloaded above and paste it in the fast boot folder.
10. Now navigate to fast boot folder where you installed earlier. Hold the shift key and right click on the mouse the in any blank space in that folder you will see open command window here click on that.
11.Now type the below code in command prompt and hit enter.
fastboot flash recovery recovery.img
Note :recovery.img is the name of the TWRP recovery that you downloaded above steps so you can rename according to the name of the file that you paste in the Mfastboot folder here the name of the file is twrp-osprey-2.8.7-test1.img .
12.You have successfully flashed TWRP Recovery in your Moto G 3rd gen (2015) running on android lollipop 5.1.1.
13. Now keep pressing volume down button on your Moto G 3rd gen (2015) until you get the recovery option in the boot loader And Press Power button to select it.
14.In Recovery ,Select Install from sd card Option.
15.Select install zip from sd card then select 0 (0 is the location of internal storage ) and now select supersu.zip and flash it.
Now select yes to install it.
16.Now wait for few seconds until installation in progress.
17.Now Select advanced > reboot to boot loader.
Select No if asked to fixed the SuperSu issue.
18.Select Start option in Boot loader by pressing Power button.
19.Congratulations You have successfully rooted you Moto G 3rd gen (2015).
Its a long process but i would suggest to do rooting only after you have lost the time period of warranty.
Hope This was helpful for you :)