$\newcommand{\na}{\nabla}\newcommand{\R}{\mathbb R}$Without loss of generality, $C=1$, so that \begin{equation} f(x)\equiv\exp\Big\{-\frac{\pi |x|^2}{2a^2}\Big\}. \end{equation}\begin{equation} f(x)\equiv\exp\Big\{-\frac{\pi |x|^2}{2a^2}\Big\}, \end{equation} where it is assumed that $a\in(0,\infty)$. Hence, $\na f(x)=-f(x)\pi x/a^2$, $|\na f(x)|^2=f(x)^2\pi^2|x|^2/a^4$, and the left-hand side of the desired equality is (with $\|\cdot\|_2:=\|\cdot\|_{L^2}$ and $x=(x_1,\dots,x_n)\in\R^n$), \begin{equation} \begin{aligned} lhs&=\frac{a^2}\pi\|\na f(x)\|_2^2 \\ &=\frac{\pi}{a^2}\int_{\R^n} dx\,f(x)^2|x|^2 \\ &=\frac{\pi}{a^2}\int_{\R^n} dx\,f(x)^2\sum_1^n x_i^2 \\ &=n\,\frac{\pi}{a^2}\int_{\R^n} dx\,f(x)^2 x_1^2 \\ &=n\,\frac{\pi}{a^2}\int_{\R^n} f(x)^2 x_1^2\,\prod_1^n dx_i \\ &=n\,\frac{\pi}{a^2}\int_{\R}dx_1\,\exp\Big\{-\frac{\pi x_1^2}{a^2}\Big\} x_1^2\ \prod_2^n \int_{\R} dx_i\,\exp\Big\{-\frac{\pi x_i^2}{a^2}\Big\} \\ &=n\,\frac{\pi}{a^2}\frac{a^3}{2\pi}\,a^{n-1}=\frac n2\,a^n. \end{aligned} \end{equation} Similarly, \begin{equation} \begin{aligned} \|f\|_2^2 &= \prod_1^n \int_{\R} dx_i\,\exp\Big\{-\frac{\pi x_i^2}{a^2}\Big\}=a^n. \end{aligned} \end{equation} So, the right-hand side of the desired equality is \begin{equation} \begin{aligned} rhs&=-\frac{\pi}{a^2}\int_{\R^n} dx\,f(x)^2|x|^2 -\|f\|_2^2 \ln(\|f\|_2^2) +n(1+\ln a)\|f\|_2^2 \\ &=-lhs-\|f\|_2^2 \ln(\|f\|_2^2)+n(1+\ln a)\|f\|_2^2 \\ &=-\frac n2\,a^n-a^n \ln(a^n)+n(1+\ln a)a^n=\frac n2\,a^n=lhs, \end{aligned} \end{equation} as desired.