Let $m_n=p_{n+1}-p_n=P(p_n)-p_n$
Exists some $l\geq 0$ such that $m\mid p_l$.
Case 1: there are infinite such $n$ than $m_n|p_l$ and $l \leq n$
Then $p_{n+1}-p_n \leq p_l \leq p_{n} \to p_{n+1} \leq 2p_n$ for inifinite many $n$
$P(p_n) \leq2p_n$ for infinite many $n$ so $P(x)=x+c$ for some const $c$ or $P(x)=2x$
Case 1.1 $P(x)=x+c$
Then we have that for $m=c$ should exists $p_l=p+lc,c|p_l \to c=1,p \to P(x)=x+1$ or $P(x)=x+p$
Case 1.2 $P(x)=2x \to p_n=2^n p$ but for prime $q,q \neq 2, q \neq p$ we get contradiction.
Case 2: For some $n_0$ we will have that if $n>n_0$ then $m_n|p_l \to l > n$
Easy to show that from $m_n=p_{n+1}-p_n$ follows that $m_n|p_{n+k+1}-p_{n+k}$ for every $k \geq 0$ and as $m_n|p_l,l > n \to m_n|p_{l-1} \to... \to m_n|p_n \to$ contradiction
Answer: $P(x)=x+1$ and $P(x)=x+p$