1/ You need to eliminate the charger and the connecting lead by substitution first.
2/ Try leaving it on charge over night to see if it then starts to charge.
3/ The Moto G5 has a removable back, so it's very easy to replace the battery if need be.
Hopefully one of these options will sort out your charging problem.