Half the x-coefficient is -3, so the equation needs to be rearranged into a form that looks like
x² -6x +(-3)² + [something]
You can get there by adding and subtracting 9 from the original equation.
y = x² -6x +9 +7 -9 . . . . . 9 added and subtracted
y = (x² -6x +9) -2
The quantity in parentheses is a perfect square, so we can write the equation in the desired form as ...
y = (x -3)² -2