Vertex form is ...
y = a(x -h)² +k
where (h, k) is the vertex and "a" is a scale factor.
When you expand this, you find it becomes
y = ax² -2ahx + ah² +k
When we compare coefficients, we find
a = 3
-2ah = 12
ah² +k = 5
Working from the top down, we can find each of the parameters of the vertex form. We already know
a = 3
Using that in the next equation, we have
-2·3·h = 12
h = 12/-6 = -2
Finally, using that in the last equation, we have
3·(-2)² +k = 5
k = 5 -12 = -7
Our vertex form is
y = 3(x +2)² -7
_____
"Completing the square" achieves the same result in slightly different fashion. When we multiply out the vertex form, we can get the equation
y = a(x² -2hx +h²) +k
Here, we recognize that the constant inside parentheses (h²) is the square of half the x-coefficient inside parentheses. So we first put the given equation in a form that almost looks like this by factoring out the leading coefficient from the first two terms:
y = 3(x² +4x) +5
Now, we recognize the coefficient of x as 4, so the square of half that will be (4/2)² = 2² = 4. When we "complete the square" we add that value inside parentheses and subtract the equivalent value outside parentheses. (Don't forget to multiply by the "3" that is outside parentheses.)
y = 3(x² +4x +4) +5 -3·4
y = 3(x +2)² -7