I found the following exercise in a set theory book.
Let $f(x)$ denote $\bigcup \left\{y : \langle x,y\rangle \in f\right\}$.
Prove that for any function $f$ and $x\in \mathsf{dom}(f)$ we have: \begin{equation} \langle x,y\rangle \in f\leftrightarrow y = f(x) \end{equation}
As I undertand it, being $f$ a function, there is a single $y$ such that $\langle x,y\rangle \in f$, hence the union is $\left\{z : z=y \right\}$, abbreviated by $\left\{y \right\}$.
What I get is therefore $\left\{y \right\}= f(x)$ rather then $y = f(x)$.
You're computing $\{y:\left <x,y\right> \in f\}$, not $\bigcup\{y:\left <x,y\right> \in f\}$.
Since (correctly) $\{y:\left <x,y\right> \in f\}=\{f(x)\}$ then $$\bigcup\{y:\left <x,y\right> \in f\} = \bigcup\{f(x)\} = f(x)$$ because $\bigcup\{A\}=A$ in general.