This question already has an answer here:
You can prove it directly from the definitions. Let $U=X\setminus A=\{x\in X:f(x)>g(x)\}$; we need only prove that $U$ is open. Let $x\in U$ be arbitrary; we’ll find an open nbhd of $x$ contained in $U$. Since $x\in U$, we know that $g(x)<f(x)$. There are now two cases.
There is some $a\in Y$ such that $g(x)<a<f(x)$. Let $$V=g^{-1}\big[(\leftarrow,a)\big]\quad\text{and}\quad W=f^{-1}\big[(a,\to)\big]\;.$$ Then $V\cap W$ is an open nbhd of $x$ (why?), and for each $y\in V\cap W$ we have $g(y)<a<f(y)$, so $V\cap W\subseteq U$.
The interval $\big(g(x),f(x)\big)$ in $Y$ is empty. Then let $$V=g^{-1}\big[(\leftarrow,f(x))\big]\quad\text{and}\quad W=f^{-1}\big[(g(x),\to)\big]$$ and argue almost exactly as in the first case.
The set $\{(x,y)\in Y^2\mid x\le y\}$ is closed in $Y^2$ and $X\to Y^2, x\mapsto (f(x),g(x))$ is continuous.