The standard method of generating a polynomial of specific zeros is to build it up as products of (x - a1), (x - a2), etc., and then multiplying it all out. If the zeros are real numbers, then they can be plugged in for a1 etc. If complex numbers are involved, then you will also need their complex conjugates to be zeros. So in this case we need solutions of 0, 2i and 3 + i. This means that we also need -2i and 3 - i to be solutions.
I'm going to treat each pair of complex solutions separately, and I'll deal with ±2i first.
(x - 2i)(x + 2i) = x2 + 2ix - 2ix - (2i)2 = x2 - 4i2 = x2 - 4(-1) = x2 + 4.
I'm going to deal with 3 + i and 3 - i a little different. I'm going to begin with what would ordinarily be the last step of an equation that was solved:
x = 3 ± i
x - 3 = ±i
(x - 3)2 = -1
x2 - 6x + 9 = -1
x2 - 6x + 10 = 0
So now I can multiply these two polynomials together and set the result equal to 0.
(x2 + 4)(x2 - 6x + 10) = 0
x4 - 6x3 + 10x2 + 4x2 - 24x - 40 = 0
x4 - 6x3 + 14x2 - 24x + 40 = 0
Now all that remains is to make sure that 0 is a solution. This can be done by multiplying the whole equation by x.
x(x4 - 6x3 + 14x2 - 24x + 40) = 0
Answer: x5 - 6x4 + 14x3 - 24x2 + 40x = 0