This is the definition of the rank of the set $X$. $\newcommand{rank}{\operatorname{rank}}$
We use the fact that $\in$ is well-founded, and that the ordinals are well-ordered. These properties allow us to define recursively this function. $$\rank:V\to\operatorname{Ord}$$
And allows us to talk about the sets $V_\alpha=\{x\in V\mid \rank (x)<\alpha\}$, for an ordinal $\alpha$. This is known as the von Neumann hierarchy.
Given the definition of $\rank$ as the least $\alpha$ such that $x\subseteq V_\alpha$, we can show the equivalence by induction.
Suppose that for an ordinal $\alpha$ we have that if $\rank(y)<\alpha$ then the equivalence holds.
If $\sup\{\rank(y)+1\mid y\in x\}=\beta<\alpha$ then we have that $y\in x$ implies that $y\in V_\beta$ and therefore $x\in V_{\beta+1}\subseteq V_\alpha$ and thus $\rank(x)<\alpha$, and the equivalence holds.
Otherwise, $\sup\{\rank(y)+1\mid y\in x\}=\alpha$, and given $\beta<\alpha$ we can find $y\in x$ such that $y\notin V_\beta$. In particular this means that $x\nsubseteq V_\beta$ therefore $x\notin V_{\beta+1}$. And indeed $\alpha$ is the minimal ordinal such that $x\in V_{\alpha+1}$, as we wanted.