We can factor by grouping.
(x^3 + 3x^2) - (6x - 18)
Factor binomials.
x^2(x + 3) - 6(x + 3)
(x^2 - 6)(x + 3)