Why doesn't there exist a wave function for a photon whereas it exists for an electron? A photon is an excitation or a particle created in the electromagnetic field whereas an electron is an excitation or a particle created in the "electron" field, according to second-quantization.
However, it is often said in the literature that the wave function of a photon doesn't exist whereas it exists for an electron. 
Why is it so?
 A: Saying that a photon doesn't have a wavefunction can be misleading. A more accurate way to say it is that a photon doesn't have a strict position observable. A photon can't be strictly localized in any finite region of space. It can be approximately localized, so that it might as well be restricted to a finite region for all practical purposes; but the language "doesn't have a wavefunction" is referring to the non-existence of a strict position observable.
An electron doesn't have a strict position observable, either, except in strictly non-relativistic models. 
In relativistic quantum field theory, nothing has a strict position observable. This is a consequence of a general theorem called the Reeh-Schlieder theorem. The proof of this theorem is not trivial, but it's nicely explained in [1].
Relativistic quantum field theory doesn't have strict single-particle position observables, but it does have other kinds of strictly localized observables, such as observables corresponding to the magnitude and direction of the electric and magnetic fields inside an arbitrarily small region of space. However, those observables don't preserve the number of particles. Strictly localized observables necessarily turn single-particle states into states with an indefinite number of particles. (Actually, even ignoring the question of localization, "particle" is not easy to define in relativistic quantum field theory, but I won't go into that here.)
For example, relativistic quantum electrodynamics (QED) has observables corresponding to the amplitudes of the electric and magnetic fields. These field operators can be localized. The particle creation/annihilation operators can be expressed in terms of the field operators, and vice versa, but the relationship is non-local. 
Technically, the Reeh-Schlieder theorem says that a relativistic quantum field theory can't have any strictly-localized operator that annihilates the vacuum state. Therefore, it can't have any strictly-localized operator that counts the number of particles. (The vacuum state has zero particles, so a strictly-localized particle-counting operator would annihilate the vacuum state, which is impossible according to the Reeh-Schlieder theorem.) 
Strictly non-relativistic models are exempt from this theorem. To explain what "strictly non-relativistic" means, consider the relativistic relationship between energy $E$ and momentum $p$, namely $E=\sqrt{(mc^2)^2+(pc)^2}$, where $m$ is the single-particle mass. If $p\ll mc$, then we can use the approximation $E\approx mc^2+p^2/2m$. A non-relativistic model is one that treats this approximate relationship as though it were exact. The most familiar single-particle Schrödinger equation is a model of this type. Such a model does have a strict position operator, and individual particles can be strictly localized in a finite region of space in such a model.
Since photons are massles ($m=0$), we can't use a non-relativistic model for photons. We can use a hybrid model, such as non-relativistic QED (called NRQED), which includes photons but treats electrons non-relativistically. But even in that hybrid model, photons still can't be strictly localized in any finite region of space. Loosely speaking, the photons are still relativistic even though the electrons aren't. So in NRQED, we can (and do) have a single-electron  position observable, but we still don't have a single-photon position observable.
"Wavefunction" is a more general concept that still applies even when strict position observables don't exist. The kind of "wavefunction" used in relativistic quantum field theory is very different than the single-particle wavefunction $\psi(x,y,z)$ familiar from strictly non-relativistic quantum mechanics. In the relativistic case, the wavefunction isn't a function of $x,y,z$. Instead, it's a function of more abstract variables, and lots of them (nominally infinitely many), and it describes the state of the whole system, which generally doesn't even have a well-defined number of particles at all. People don't use this kind of wavefunction very often, because it's very difficult, but once in a while it's used. For example, Feynman used this kind of "wavefunction" in [2] to study a relativistic quantum field theory called Yang-Mills theory, which is a simplified version of quantum chromodynamics that has gluons but not quarks.
In this generalized sense, a single photon can have a wavefunction.
In the non-relativistic case, the $x,y,z$ in $\psi(x,y,z)$ correspond to the components of the particle's position observables. When physicists say that a photon doesn't have a wavefunction, they mean that it doesn't have a wavefunction that is a function of the eigenvalues of position observables, and that's because it doesn't have any strict position observables.
Also see these very similar questions:
Can we define a wave function of photon like a wave function of an electron?
Wave function of a photon?
EM wave function & photon wavefunction

References:
[1] Witten, "Notes on Some Entanglement Properties of Quantum Field Theory", http://arxiv.org/abs/1803.04993
[2] Feynman (1981), "The qualitative behavior of Yang-Mills theory in 2 + 1 dimensions", Nuclear Physics B 188: 479-512,
https://www.sciencedirect.com/science/article/pii/0550321381900055
A: Here is the wavefunction of the photon, which is a solution of a quantized maxwell's equation:

In quantum field theory it is necessary to have a plane wave function solution for the fields on which creation and annihilation operators operate.
This blog post describes how the classical fields emerge from the quantum ones of QFT.
