Note: The following hints/explanation is NOT a proof nor 100% rigirous. Its just a short explanation of the general idea what you are supposed to do.
You are looking for a functional on a suitable space s.t. $v $ solves the PDE $\iff$ $v=min_{u \in H} E(u)$, where H is your underlying space, often a Hilbert Space. I assume you are looking are looking at $H=C^2(\Omega) $ with suitable boundary conditions if they exist and your Hilberspace is $H=L^2$. Since you are looking for a minimzer, it makes sense to look at $\nabla_{L^2}E(u) \in H$, that is the vector statisfying $\lim_{t \to 0} \frac{E(u+ t \phi)-E(u)}{t}=<\nabla_{L^2}E(u),\phi> $ for all smooth test functions $\phi $ with compact support. So what you do know is calculate the $L^2$-Gradient of your functional with the limit-definition. Lets do that:
$$
lim_{t \to 0}\frac{E(u+ t \phi)-E(u)}{t}= \\
lim_{t \to 0} \frac{1}{t} \int_{\Omega} 1/2|\nabla(u+t \phi)|²+1/4(1-(u+t \phi)²)²-1/2|\nabla u|²-1/4(1-u²)²= \\
$$
For the polynominal term, you it is almost the same calculation as calculating the difference quotient of $(1-u²)²$ and for the $\nabla$-term, you expand the terms and use integration by parts (also knows as greends identiy):
$$
\int_{\Omega}<\nabla u, \nabla \phi >=\int_{\Omega}\phi \Delta u
$$
After simplifying and taking the limit you will recieve:
$$
\int_{\Omega} (\Delta u+(1-u²)u) \phi=<\nabla_{L^2}E(u),\phi>
$$
From the intuition, if there is a minimizer, $\nabla_{L^2}E(u)=0$ should hold. So therefore $\Delta u+(1-u²)u=0$.
For a more mathematically precise answer, study Euler-Lagrange equations and their pre-requisites. The method is often called "Energy method".