Try the steps that others have posted above to eliminate the ammo or shooting technique as possible sources of the accuracy issue.
But what I suspect is that someone "assembled" the gun from parts. That is different from assembling and fitting the parts. All of the parts may have gone together without really obvious signs of binding or not firing, jamming, etc. when shooting it. But there may be some fairly serious dimensional issues, especially regarding the bushing to slide fit, the barrel to bushing fit, and the fit of the lower and upper barrel lugs to the frame, slide stop pin and slide.
But what I suspect is that someone "assembled" the gun from parts. That is different from assembling and fitting the parts. All of the parts may have gone together without really obvious signs of binding or not firing, jamming, etc. when shooting it. But there may be some fairly serious dimensional issues, especially regarding the bushing to slide fit, the barrel to bushing fit, and the fit of the lower and upper barrel lugs to the frame, slide stop pin and slide.