Where does $\hat{P}\psi(x) = -i\hbar \partial_x \psi(x)$ come from? It's a very basic question, where does the relation $$\hat{P}\psi(x) = -i\hbar \partial_x \psi(x)$$ for any square integrable $\psi(x)$ come into existence? Some texts I found states that the above relation comes as a consequence of momentum being defined as generator of translation. But what is the basis of this definition? If momentum were defined to be generator of other form of symmetry, then it wouldn't have had the form as it does now.
In some other text, it's the other way around. Namely the action of momentum on a wavefunction is defined to be $$\hat{P}\psi(x) = -i\hbar \partial_x \psi(x)$$ and thence it leads to momentum being the generator of translation.
Which one is the correct one? How was such action of momentum on wavefunction historically developed?
 A: Historically, you probably want to start with the de Broglie relations (i.e. $p = \hbar k$), which are just a wild guess. This immediately pops out the form of $p$ as an operator if the wavefunction is a plane wave.
Mathematically, $p$ should be defined as the generator of translations (or equivalently the conserved quantity corresponding to translational invariance), from which we derive its action on wavefunctions as $-i\hbar \partial_x$. You can do it the other way (which is logistically easier for some textbooks) but that's awkward.
Physically, it doesn't matter. You ask, "what if momentum were defined to be the generator of some other symmetry?", but this is missing the point, because then it would represent a different physical quantity. The only important thing is that momentum is the amount of "oomph" a particle has when it hits something, and you can derive that from any of the three options above.
A: Momentum is the generator of spacial translations, even in classical physics. Anyway, you can find a derivation here or in Sakurai's book Modern Quantum Mechanics. They are more or less the same and go like this:
The translation operator is the operator $T( a)$ such that
$$T( a) \mid x \rangle = \mid x+a\rangle$$
From the definition it follows that the adjoint of $T$ performs a backwards translation:
$$T^\dagger(a) \mid x \rangle = \mid x-a\rangle$$
Of course, we must require that if we translate and then translate back the state is unchanged:
$$T^\dagger(a) T(a) \mid x \rangle = \mid x \rangle$$
From which it follows that $T$ must be unitary: $T^\dagger=T^{-1}$
Any unitary operator can be written in the form
$$T(a) =e^{-iKa}$$
with $K$ hermitian. Now you will find that the eigenstates of $K$ in the position basis are plane waves:
$$\langle x \mid k \rangle = \psi_k(x) \sim e^{ikx}$$
Now (and this is the crucial passage), the De Broglie hypothesis comes into play:
$$p = \hbar k$$
so that
$$T(a)=e^{-iPa/\hbar}$$
And with some math (the passages are in the paper I linked) you can show that
$$P \psi(x) = \langle x \mid P \mid x \rangle = - i \hbar \frac{\partial \psi}{\partial x}$$
The De Broglie hypotesis is not strictly necessary. For example Sakurai observes that for an infinitesimal translation you have
$$T(dx) = 1-i K dx$$
and that in classical mechanics the generating function of the infinitesimal translation
$$x'=x+dx$$
$$p'=p$$
is
$$F(x,p')=x p'+ p dx$$
where $xp'$ is the generating function of the identity transformation. From the similarity between $F(x,p')$ and $T(dx)$ he then speculates that $K$ is related to momentum, and since $K \ dx$ must be dimensionless we must have
$$K=\frac{P}{\text{constant with dimensions of an action}}$$
It turns out from experiments that our constant is exactly $\hbar$.
A: Momentum and position are conjugate variables in classical mechanucs, which means they satisfy the Poisson bracket relationship. When quantum mechanics was invented the Poison bracket relation was replaced by the operator commutation relationship which results in the relation under consideration. 
A: That $\hat{P} = - i \hbar \partial_x$ generates translations comes from a straight-forward computation: if $\psi$ is continuously differentiable, and $\Psi$ as well as its derivative are square integrable, then you can prove that 
\begin{align}
i \frac{\mathrm{d}}{\mathrm{d} y} \bigl ( \psi(x - y) \bigr ) \big \vert_{y = 0} = - i \partial_x \psi(x)
\end{align}
holds, and you write $\mathrm{e}^{- i y \cdot \hat{P}} \psi(x) = \psi(x - y)$. 
The best physical motivation in my opinion why $\hat{P}$ should be called “momentum” (operator) is via a semiclassical limit using standard techniques. You can use Wigner-Weyl calculus to show that if the potentials vary slowly compared to the wavelength of your wave function, then 
\begin{align}
\hat{P}(t) = \widehat{p(t)} + \mathrm{error}
\end{align}
holds true, i. e. the Heisenberg observable $\hat{P}(t)$ associated to momentum is approximately equal to the quantization of the classically evolved momentum $p(t)$. You can make similar arguments for position, angular momentum and other observables. Making this precise is quite difficult. 
A simplified, but in my opinion excellent explanation can be found in Ehrenfest's 1927 paper. Unfortunately, most quantum mechanics text books I have seen do a very bad job explaining this point (perhaps because they can't read Ehrenfest's paper, it is written in German), though. 
A: Ab initio the momentum operators can be constructed  using  de Broglie Plane waves
In one dimension, using the plane wave solution  of the Schrodinger equation,the wave function
Psi =  exp. i (kx -wt) ,
if one takes the partial derivative  w.r. to  x of the wave function
delta/delta x (Psi)  = ik. Psi
and   using  de-Broglie relation     p = hbar  . k      we get
delta/delta x (Psi)  = i p/hbar . Psi
The  above  relation  suggests the operator equivalence of momentum:
p-operator = -ihbar. Delta/deltax
so the momentum value p is a scalar factor, the momentum of the particle and the value that is measured, is the eigenvalue of the momentum operator.
As the partial derivative is a linear  operator the momentum operator is also linear,
(one can think of momentum  as  generator of translational  symmetry)
and because any wave function can be expressed as a superposition of  other possible  states
when this momentum operator acts on the entire superimposed wave, it furnishes  the momentum eigenvalues for each plane wave component.
