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