Why electrons have less energy than photons with the same wavelength?
For the photon we have $$E_\gamma = \frac{hc}{\lambda}$$ and for the electron $$E_e = \frac{h^2}{2m\lambda^2} =\frac{hc}{\lambda} \frac{h}{2mc\lambda} = E_\gamma \frac{h}{2mc\lambda}. $$ You can check that the proportionality factor is dimensionless. So what you are asking is why this quantity is less than unity. But recall that $$\frac{h}{\lambda} =p$$ where $p$ is the momentum. What we are looking at is really (one half) the ratio $$\frac{pc}{mc^2} = \frac{mvc}{mc^2}$$ where I assumed that $v \ll c$, that is, we have a non-relativistic electron. Then we get the result you stated in your question. On the other, hand if we don't make this approximation we have the ratio $$\frac{pc}{mc^2} =\frac{mv\gamma c}{mc^2} = \frac{v\gamma}{c}$$ which is unbounded when $v \to c$.
You could also argue from Einstein's $$E^2 = m^2 + p^2$$ (in units where $c = 1$). For $m = 0$ we have of course $E = p$. If you make a Taylor expansion of $E$ for $m\neq 0$, $$E = m + \frac{p^2}{2m} + \ldots$$ you see that the kinetic energy, compared to the energy of a massless particle has a factor $p/m$ (as we found above). The non-relativistic regime is precisely when this quantity is small, and if it is not, we have to include terms proportional to $p^4/m^3$ and higher, and again that the energy can be larger for a massive particle than for a massless particle with the same momentum. So the answer to your question really is: because you are considering non-relativistic particles.
The energy of the particle is proportional to the oscillation frequency of its wavefunction, $E=h\nu$. A photon always moves at the speed $c$, so its wavelength is related to the frequency in the usual way for a traveling wave, $\lambda = c/\nu = hc/E$.
A massive particle moves more slowly than the photon, so its wavelength is shorter for the same amount of energy. Naively, we might guess that a particle moving at speed $v$ would have $\lambda = hv/E$ as its wavelength. This is not correct because it fails to account for relativity, but it may give you an idea of why the wavelength is shorter for a particle with mass.
To get the correct relationship, we need to consider the relativistic energy of the particle. According to special relativity, the energy is actually $E = \sqrt{p^2c^2 + m^2c^4}$. For a particle at rest, this is the famous $E=mc^2$. The kinetic energy is the difference between the total energy and the energy at rest (mass energy).
For a photon, all of the energy is kinetic because it has no mass. For a non-relativistic electron, with momentum $p \ll mc$, we can use a Taylor expansion to get an approximate expression for the kinetic energy.
\begin{align} KE &= \sqrt{m^2c^4 + p^2c^2}-mc^2\\ &\approx mc^2\left(1+{1 \over 2}{p^2c^2 \over m^2c^4 }\right)-mc^2\\ &={p^2 \over 2m} \end{align}
The DeBroglie wavelength is related to momentum by $\lambda =h/p$, and pluggin it in we obtain the formulas you asked about.
\begin{align} E_{\mathrm{photon}} &= {hc \over \lambda}\\ E_\mathrm{electron} &= {h^2 \over 2m\lambda^2} \end{align}