The axiom of infinity for Zermelo–Fraenkel set theory is stated as follows in the wikipedia page:
Let $S(w)$ abbreviate $ w \cup \{w\} $, where $ w $ is some set (We can see that $\{w\}$ is a valid set by applying the Axiom of Pairing with $ x=y=w $ so that the set $z$ is $\{w\} $). Then there exists a set $X$ such that the empty set $\varnothing$ is a member of $X$ and, whenever a set $y$ is a member of $X$, then $S(y)$ is also a member of $X$.
I don't understand the intuition behind the set $ w \cup \{w\} $. Why this causes the set $X$ to be infinite ? I think $ \{w\} $ is enough.
The intuition comes from the definition of the von Neumann ordinals. We define an ordinal as the set of its predecessors, which means that the successor ordinal of $\alpha$ is exactly $\alpha\cup\{\alpha\}$.
The finite ordinals corresponds to the natural numbers, so we can easily define $0=\varnothing$ and $n+1=n\cup\{n\}$. The axiom of infinity is equivalent to saying that there is a set whose members are exactly all the finite ordinals.