Omitting the hypotheses of finiteness of the measure in Egorov theorem
We can, without loss of generality, assume that the sequence $f_n$ is decreasing and convergent almost everywhere to $0$ (if it's not the case, consider $\displaystyle g_n(x):=\sup_{k\geq n}|f_n-f(x)|$, which is dominated by $2g$, an integrable function. We fix $\varepsilon>0$, and we are looking for a measurable set $A$ such that $\mu(X\setminus A)\leq \varepsilon$ and the sequence $\{f_n\}$ converges uniformly to $f$ on $A$. We have for all integers $j$ and $n$ that $$\mu\left(\left\{g_n\geq \frac 1j\right\}\right)\leq j\int_X |g_n|d\mu,$$ and the monotone convergence theorem gives us that $\displaystyle\lim_{n\to\infty}\int_X |g_n|d\mu=0$. Hence for all $j\geq 1$, we can pick $n_j\in\mathbb N$ such that $$\mu\left(\left\{g_{n_j}\geq \frac 1j\right\}\right)\leq \varepsilon2^{-j}.$$ Now, put $A_j:=\left\{g_{n_j}\geq \frac 1j\right\}$ and $\displaystyle A:=\bigcap_{j\geq 1}\complement_X A_j$. We have $$\mu(X\setminus A)=\mu\left(\bigcup_{j\geq 1}A_j\right)\leq \sum_{j\geq 1}\mu(A_j)=\varepsilon\left(\frac 1{1-2^{-1}}-1\right)=\varepsilon$$ and $\displaystyle\sup_{x\in A}\,|g_{n_j}-0|\leq \frac 1j$. Since the sequence $\displaystyle\left\{\sup_{x\in A}\,g_n(x)\right\}$ is decreasing and has a sub-sequence which converges to $0$, the whole sequence converges to $0$, and we are done.
Here is another solution:
We can write:
$$X=\{ g>1\}\cup(\bigcup\limits_{k=1}^{\infty}\left\{ 2^{-k}<g\leqslant2^{1-k}\right\})\cup \{g=0\}$$ Notice that the above sets are all disjoint.
Apply Egoroff's theorem to each of the sets: $$\{ g>1\},\bigcup\limits_{k=1}^{\infty}\left\{ 2^{-k}<g\leqslant2^{1-k}\right\}$$
Then there exist $A\subset G=\{g>1\}$ ,and $A_k\subset G_k=\left\{ 2^{-k}<g\leqslant2^{1-k}\right\}, $ such that: $$\mu (A)<\varepsilon/2 , \mu (A_k)<\varepsilon 4^{-k} $$ and $$f_n\longrightarrow f$$uniformly in $E^c=(G\setminus A)\cup(\bigcup\limits_{k=1}^{\infty}G_k\setminus A_k)\cup \{f_n=0,\forall n\}$, where the last set in the union is a superset of $\{g=0\}$.
Now, it suffices to prove that $\mu (E)<\varepsilon$.
Indeed, after some simple set calculations (using the fact that we decomposed X in disjoint sets) we can obtain that: $$E=X\setminus\left\{(G\setminus A)\cup(\bigcup\limits_{k=1}^{\infty}G_k\setminus A_k)\cup \{f_n=0,\forall n\}\right\}\subset$$ $$(X\setminus(G\setminus A))\cap(X\setminus(\bigcup\limits_{k=1}^{\infty}G_k\setminus A_k))\cap (X\setminus\{g=0\})\subset$$ $$A\cup(\bigcup\limits_{k=1}^{\infty} A_k)$$ Therefore, $$\mu (E)\leqslant \mu (A\cup(\bigcup\limits_{k=1}^{\infty} A_k))\leqslant \mu(A)+\mu (\bigcup\limits_{k=1}^{\infty} A_k))<\varepsilon/2+\sum\limits_{k=1}^\infty \varepsilon4^{-k} =\varepsilon/2+\varepsilon/3 <\varepsilon$$