<s>[INST] How does $x^2-8x+17=0$ have nonreal solutions? 
The solutions of $x^2-8x+17=0$ are $4 + i$ and $4 - i$.

Well, I calculated and the results are different.
$$\begin{align}
x^2-8x+17 &= 0 \\
x^2-8x &=17 \\
x(x-8) &= 17 
\end{align}$$
So the roots are $x=17$ or $x=17+8=25$.
Why $i$ comes from the problem? Could you please explain about it?
 [/INST] $x(x-8)=17$ is a true (but not useful) statement.
But $ab = m$ most certainly does !NOT! mean $a =m$ or $b=m$.
Consider $3\cdot 5 = 15$ where neither $3=15$ nor $5 = 15$.  Or consider $\frac 2{5}\cdot {85}2 = 17$ where neither $\frac 12$ nor $\frac {85}2$ equal $17$.
In fact $x(x-8)=17$ CAN'T mean $x =17$ unless $x-8=1$.  But $17-8 \ne 9$.  And $x-8$ CAN'T equal $17$ unless $x =1$ and $1-8 \ne 17$.
So your solution is definitely wrong.
We could true $x = \frac {17}{x-8}$ and $x-8 = \frac {17}x$ neither of which are equal to $1$ or $17$ but .... that doesn't get us anywhere.  (Also this assumes $x, x-8$ are neither $0$... which we can assume because if either were $0$ their product would have to be $0$ and not $17$.)
.....
We can't to $ab=m$ means $a=m$ or $b=m$ because that's just garbage.
But we can do $ab = 0$ means $a=0$ or $b=0$.  Why does this work for $0$ and not for $m$?
Because $0\cdot anything = 0$ always happens while $m \cdot x = m$ doesn't always happen. And because $ab=m$ where $a\ne m; b\ne m$ can happen $ab = 0$ where $a\ne 0; b\ne 0$ can NOT happen.
....
So we could solve this by factoring $x^2 -8x + 17$ to $(x+a)(x+b)$ and having $(x+a)(x+b) = 0$. so $x+a =0$ or $x+b = 0$.
The only trouble is .... we don't know how to factor $x^2 - 8x + 17$......
But we can complete the square.   If we have $x(x-8) = 17$ we can say anything about $x$ or $x-8$.  But if instead we had $(x+a)(x+a) = M$ where $x+a$ and $x+a$ are the same things and not different things. the we can conclude if $(x+a)^2 = M$ then $x+a = \pm \sqrt M$.
And we can find an $x^2 -8x + something\ that\ isn't\ 17$ is a perfect square so we can do
$x^2 - 8x + 17 =0$
$x^2 - 8x= -17$
$x^2 - 8x +something\ that\ isn't\ 17\ but\ which \makes\ this \side\ a\ perfect\ square = -17 ++something\ that\ isn't\ 17\ but\ which \makes\ this \side\ a\ perfect\ square$
So what is $something\ that\ isn't\ 17\ but\ which \makes\ this \side\ a\ perfect\ square$?
If $x^2 - 8x +something\ that\ isn't\ 17\ but\ which \makes\ this \side\ a\ perfect\ square = (x+ \ who \ knows)^2$ then
$x^2 - 8x +something\ that\ isn't\ 17\ but\ which \makes\ this \side\ a\ perfect\ square = x^2 + 2\ who \ knows\ x + \ who\ know^2$.
So $-8x = 2\ who\ knows\ x$ so $\ who\ knows = \frac {-8}2 = -4$.
And $something\ that\ isn't\ 17\ but\ which \makes\ this \side\ a\ perfect\ square = \ who\ know^2= (-4)^2 = 16$.
.....
SO.....
$x^2 -8x + 17 = 0$
$x^2 - 8x = -17$
$x^2 - 8x + 16 = -17 +16$
$(x-4)^2 = -1$.
Now that means $x-4 = \pm \sqrt{-1}$.

AND $\sqrt{-1} = i$!  THAT IS WHERE THE $i$ CAME FROM!

And so $x - 4 =\pm i$
And $x = 4 \pm i$.  So $x = 4+i$ or $x = 4-i$.
</s>