If the gun is brand-new-out-of-the-box, and/or you are relatively new to Glocks, then I'd say it's your shooting fundamentals, not the gun. If the gun is used, and has had the sight replaced, then it might be the sights, but for most new Glockers, it's a trigger-control thing.
New Glock shooters often shoot low, or low-left/low-right, because of bad habits they have picked up when shooting other handguns. As you squeeze the Glock's trigger, you will feel steady resistance, and then a slight increase in resistance. Most folks think this is the "end" of the trigger pull, and the gun is about to fire, so they think they can snap/jerk or just "rush" the trigger through last little bit of travel. Unfortunately, when you feel that little extra resistance, there is still more than a little trigger travel left, and if you snap or jerk the trigger, the gun can move a long way off the center of the target before the trigger finally releases the striker, fires the round, and the bullet gets out of the barrel. Please don't take this personally; I don't know you or your shooting style, and I'm not saying I do. All I am saying that this is a VERY common problem with new Glock shooters, and I'm assuming you are having a similar struggle. Thankfully, it's a fairly easy challenge to overcome.
Concentrate on a slow squeeze all the way through the pull until the gun fires. Don't think "fire"; think "add more pressure, more pressure, more pressure, etc." until you hear a loud noise and the gun bounces in recoil. Then look at your target, and there will probably be a hole very near the center. That's the basics; squeeze, get a good hit. Pull/snap/jerk/slap the trigger, get something OTHER than a good hit.
Trigger control is super important in handgun shooting, as the smallest last-minute snap/jerk can move these very light guns quite a bit before the bullet gets out of the barrel. If your shots are scattered on target, with some up near the middle and others trailing down and to one side, that is a classic trigger-control problem shot pattern. Once you get used to squeezing the trigger gently, without moving the gun at the moment of firing, the shot groupings will become more and more consistent; the groups will look more rounded, with the shot holes clustered tightly together. That's a sign of good trigger control.
Another potential problem is squeezing the trigger to one side or another instead of straight back. Make sure you are pressing straight to the rear, not hooking or pushing the trigger off to one side as you squeeze.
Watch the sights all the way through the squeeze, and make small corrections as you squeeze to keep the sights as near to the center as possible. Yes, I know they are moving; they move for all of us. It's the shooter that can ignore the minor movements (resisting the urge to "slap/snap/jerk" the trigger as the sights slide across center) and squeeze through the entire pull, nice and steady, that gets the nice round groups near the center of the target.
Good luck, and let me know how it works out for you!
"Placement is power" -- seen in an article by Stephen A. Camp
(RIP, Mr. Camp; you will be remembered, and missed)