Consider $n = 1$ and the function \begin{align*} f \colon \mathbb R &\to \mathbb R\\ x &\mapsto \begin{cases} 1/q & x = p/q \in \mathbb Q, \operatorname{gcd}(p,q) = 1\\ 0 & x \not\in \mathbb Q\end{cases} \end{align*} Let $\bar x \in \mathbb R \setminus \mathbb Q$, then $f$ is continuous at $\bar x$. Let $U$ be a neighbourhood of $(\bar x, 0)$, then $U \supseteq (\bar x - \epsilon, \bar x + \epsilon) \times (-\epsilon, \epsilon)$ for some $\epsilon > 0$. Let $p/q \in (\bar x - \epsilon, \bar x + \epsilon)\cap \mathbb Q$, and $x_n \to p/q$ be a sequence of irrationals in $(\bar x -\epsilon, \bar x +\epsilon)$. Then $(x_n,0) \in \operatorname{epi} f\cap U$ for each $n$, but their limit $(p/q, 0)\in U \setminus \operatorname{epi} f$. Hence $\operatorname{epi} f$ is not closed in $U$. As $U$ was an arbitrary neighbourhood of $(\bar x, 0)$, it is not locally closed at $(\bar x, 0)$.