Each non-zero real or complex number $w$ has exactly two square roots $r_1, r_2$ which differ by sign ($r_2 = - r_1$). If $w$ is a positive real number, then both $r_1, r_2$ are real and the standard convention is to write $\sqrt w$ for the positive square root. In all other cases there is no universally accepted interpretation of $\sqrt w$. If $w$ is a negative real number, then one may of course use the definition $\sqrt w = i \sqrt {\lvert w \rvert}$ (as you do in your calculation). This is a good and reasonable choice for $\sqrt w$, but it is only one of two possible choices. For $w \notin \mathbb R$ it is even more arbitrary to define a unique value of $\sqrt w$.
You corrrectly state that the quadratic equation
$$z^2 + \lambda z - 4 = 0 \tag{1}$$
has the two solutions
$$z=\frac{-\lambda \pm \sqrt{\lambda^2+16}}{2} \tag{2}$$
As explained above, this formula is based on a specific interpretation of the expression $\sqrt{\lambda^2+16}$; it involves a convention concerning the symbol $\sqrt{\phantom x }$. Perhaps it would be a more neutral way to say that the solutions of $(1)$ have the form
$$z=\frac{-\lambda + r}{2} \tag{3}$$
where $r$ is any square root of $\lambda^2+16$, i.e. any solution of
$$r^2 = \lambda^2+16 . \tag{4}$$
If you want to have $i$ as a solution of $(1)$, you have to determine $\lambda \in \mathbb C$ and $r$ with $r^2 = \lambda^2+16$ such that
$$i=\frac{-\lambda + r}{2} \tag{5}$$
You write right from the start $r = \sqrt{\lambda^2+16}$, but this is inadequate if you use a fixed convention for the symbol $\sqrt{\phantom x }$. In fact, you must be aware that only one of the two solutions of $(4)$ will satisfy $(5)$ and the other produces a value $ \ne i$. Can you be sure that a fixed square root convention produces the appropriate value for $r$? No, you can't.
Your calculation correctly gives $\lambda = -5i$ and thus $\lambda^2+16 = -9$. The above convention for square roots of negative real numbers produces then $r = \sqrt{-9} = 3i$ which does not satisfy $(5)$. The other solution of $(4)$ is $r = -3i$ and this is the adequate one which satisfies $(5)$.
Update:
A simpler approach is this. You want to find $\lambda$ such that $i$ is a root of $(1)$. Let $\rho$ be the second root of $(1)$. Then
$$(z-i)(z-\rho) = z^2 + \lambda z - 4$$
which gives $i\rho = -4$ and $-(i + \rho) = \lambda$. The first equation implies $\rho = 4i$ and the second implies then $\lambda = -5i$.