We know that if a product a⋅b=0, then either a=0 or b=0 (or both). So, if we want a polynomial to have certain zeroes, in this case 0 and −3, we can multiply to polynomials that have those zeroes.
It's clear that the choice is not unique, but we usually choose the easiest ones: if we want x0 to be a zero of the polynomial, (x−x0) is surely a good option, since the result in x0 gives x0−x0=0.
So, if we want 0 to be a solution, our polynomial would be (x−0)=x. As for −3, the same steps lead us to (x−(x−3))=(x+3)
Now we have a polynomial with a root in zero (namely x), and a polynomial with a root in −3 (namely x+3). If we multiply them, we have the desired polynomial:
x(x+3)=0 if x=0 or x+3=0, i.e. x=−3.
To write it as an explicit polynomial, simply expand the expression:
x(x+3)=x2+3x