I saw in my book that $2x^2 - 2x + 2$ factored became $2(x^2 - x + 1)$.
Why it does not became $2(x(x - 1) + 1)$? Is it wrong or correct as well?
Yes, it's true that $x(x-1)+1 = x^2 - x + 1$. However, when we think about "factoring", we think about the factors (thing being multiplied), so we don't think of $x(x-1)+1$ as different from $x^2-x+1$.
(Just like if we say "factor $77$", we can write $77 = 7\times 11$ or $77 = 7\times(10+1)$, but we don't really like to write $11$ as $10+1$ when thinking about factors because what we are interested in is the factor.)
Writing $x^2-x+1$ as $x(x-1)+1$ is not that helpful in this situation.