How can I find all integers $x≠3$ such that $x−3|x^3−3$

Hint $\ {\rm mod}\ x\!-\!3\!:\ x\equiv 3\,\Rightarrow\, x^3\!-3\equiv 24,\ $ so $\,x\!-\!3\mid x^3\!-3\iff x\!-\!3\mid 24$

If modular arithmetic is unfamilar, by the Factor Theorem, $\, x\!-\!3\mid f(x)\!-\!f(3)\,$ so for $\,f(x) = x^3\,$ we infer $\,x\!-\!3\mid x^3\!-3^3 = (x^3\!-3)-24,\,$ thus $\,x\!-\!3\mid x^3\!-3\iff x\!-\!3\mid 24.$

Generally $\ a\mid b \iff a\mid (b\ {\rm mod}\ a),\ $ so we can often simplify divisibility statements by reducing the dividend modulo the divisor. Above $\ x^3\!-3\ {\rm mod}\ x\!-\!3\,=\, 24,\,$ which is a special case of the Polynomial Remainder Theorem $\,f(x)\ {\rm mod}\ x\!-\!a\, =\, f(a)$

Or, equivalently, we can employ the $\rm\color{#c00}{EA} = $ Euclidean Algorithm for the gcd as follows

$$ a\mid b\iff a = (a,b)\overset{\rm\color{#c00}{EA}} = (a,\, b\bmod a)\iff a\mid (b\bmod a)$$


$$x - 3 | x^3 - 3$$ $$\frac{x^3 - 3}{x - 3} = \frac{x^3 - 3 + 27 - 27}{x - 3}$$

$$ = \frac{x^3 - 27 + 24}{x - 3}$$

$$ = \frac{x^3 - 3^3 + 24}{x - 3}$$

$$ = \frac{(x - 3) \times (x^2 + 3x + 9) + 24}{x - 3}$$

$$ = x^2 + 3x + 9 + \frac{24}{x - 3}$$

The result is integer when $x - 3$ is a factor of $24$ and $x \ne 3$