If the result of what you thought ought to have been the perfect ball strike, is a ball flight that is off track, then don’t get angry or frustrated. Get back to basics.
REMEMBER THE GOLF BALL HAS A SPIN AXIS If you want a straight ball flight after impact, the spin axis will need to remain horizontal.
If the club face is not square to the path of the club through impact, then the spin axis of the golf ball will be tilted. In this case the ball is going to move left to right.
If you want straighter
Then choose a golf ball ‘programmed’ to go straighter with reduced sidespin. Make sure you play with a lie angle fitted to your swing so that its easier to square the face in the critical 0.0005 seconds and one-inch of contact. You’ll have a better spin axis.