In this example we are multiplying two binomials so FOIL method can be used.
$$ \begin{aligned} \left( \color{blue}{ x-3}\right) \cdot \left( \color{orangered}{ x^2-9}\right) &= \underbrace{ \color{blue}{x} \cdot \color{orangered}{x^2} }_{\text{FIRST}} + \underbrace{ \color{blue}{x} \cdot \left( \color{orangered}{-9} \right) }_{\text{OUTER}} + \underbrace{ \left( \color{blue}{-3} \right) \cdot \color{orangered}{x^2} }_{\text{INNER}} + \underbrace{ \left( \color{blue}{-3} \right) \cdot \left( \color{orangered}{-9} \right) }_{\text{LAST}} = \\ &= x^3 + \left( -9x\right) + \left( -3x^2\right) + 27 = \\ &= x^3 + \left( -9x\right) + \left( -3x^2\right) + 27 = \\ &= x^3-3x^2-9x+27; \end{aligned} $$