How does $\{a, b\}$ "become" $b$ in $(a, b) = \{\{a\}, \{a, b\}\}$?
If I substitute $a$ and $b$ with, say, $1$ and $2$, how is it explained that from $(1, 2) = \{\{1\}, \{1, 2\}\}$
$$2 = \{1, 2\}$$
How does $\{a, b\}$ "become" $b$ in $(a, b) = \{\{a\}, \{a, b\}\}$?
If I substitute $a$ and $b$ with, say, $1$ and $2$, how is it explained that from $(1, 2) = \{\{1\}, \{1, 2\}\}$
$$2 = \{1, 2\}$$
In abstract mathematics we want to define things rigorously, and with set theory as the foundation of mathematics, everything is at the fundamental level a set. With this in mind, ask yourself "how would we define the ordered pair $(a,b)$ in terms of a set?". Well, the set $\{a, b \}$ is clearly not a suitable definition, because $\{ a,b \} = \{b, a \}$, so this would not give us an ordered pair, merely a pair. The set needs to impose an order on the two elements, i.e. a way to distinguish what is the first element and what is the second. Well, one way to distinguish them would be to append to the set $\{a, b \}$ a singleton indicating which of the two is the first element. This is the motivation behind the definition $$(a,b) = \{ \{a \}, \{a, b \} \}.$$ This definition includes the two elements present in the ordered pair and it indicates an order since one element (the first) occurs both in the singleton and in the two-element set.
It is important to note that this does not mean that $b = \{ a,b \}$ (no set may be a member of itself by the Axiom of Foundation). Here you should think of $a$ and $b$ as to given objects and the set $\{ \{a \}, \{a, b \} \}$ as your definition of what the expression $(a,b)$ means. A priori, the string $(a,b)$ has no meaning. We give it meaning through the definition above (often referred to as Kuratowski's construction).
I hope this clearifies the matter for you. If not, don't hesitate to leave a comment about what is still unclear.
$(a,b)$ is an ordered set, which becomes $\{\{a\},\{a,b\}\}$ in terms of unordered sets through the convention that the $n$'th element of the ordered set becomes an unordered set with cardinality $n$ containing the $n$'th and all previous is the. The $=$ in this case represents that convention of considering ordered sets special cases of unordered sets.