The hint suggests to do this:
Let $A$ be a closed set and $f \colon x\mapsto d(x,A)$.
If you can show that $f$ is continuous (can you?), then you get that every $A_n=f^{-1}(-\infty,\frac1n)=\{x\in X; d(x,A)<\frac1m\}$ is open. (One of equivalent conditions to continuity is that preimage of any open set is open.)
Now you should show that $A=\bigcap\limits_{n=1}^\infty A_n$. (In the proof, the closedness of $A$ should be used. Do you know how to show this?)
This shows that every closed set is an intersection of countably many open sets, so it is a $G_\delta$-set.
See also this closely related question: Are all compact sets in $ \Bbb R^n$, $G_\delta$ sets?
If you copied the assignment correctly, it is in fact much easier.
If $A$ is closed set that $A$ is union of a system containing a single closed set - namely the set $A$. So it is $F_\sigma$.
I only mentioned closed sets. Analogous facts for open sets can be shown by taking complements.
A comment on what you suggested in you post as a solution.
If you define $A_n=\bigcup_{x\in U} B(x,1+1/n)$ then already $A_1$ is a proper superset of $U$ if, for example, $U=(0,1)$ in $\mathbb R$.
So, in this example, you have $\bigcup_n A_n \supseteq A_1 \supsetneqq U$ and you definitely can't prove $U=\bigcup_n A_n$.