Expand and simplify completely: \begin{align*}
x\left(x(1+x)+2x\right)-3(x^2-x+2)
\end{align*}
Begin by distributing in the innermost parentheses: \begin{align*}
&\ \ \ \ x\left(x(1+x)+2x\right)-3(x^2-x+2) \\&= x(x+x^2+2x) - 3(x^2-x+2)
\end{align*} Now, distribute again: \begin{align*}
x^2+x^3+2x^2-3x^2+3x-6
\end{align*} Finally, combine like terms to get \begin{align*}
\boxed{x^3+3x-6}
\end{align*}