This is just an addendum to the other answer.
The more general problem that replaces polynomials with rational functions is also solved.
From the paper Associative rational functions in two variables (2001):
We say that $R(x, y)$ is associative if the equation $$R(R(x, y), z) = R(x, R(y, z))$$ is valid in $F(x, y, z)$, the rational function field with distinct variables $x$, $y$, $z$.
A rational function $R(x, y)$ is said to be equivalent to $R(x, y)$ if there is a linear fractional map $f(x) = (a x + b) / (c x + d) \in \overline{F}(x)$, $ad - bc \neq 0$, such that $$R_1(x, y) = f^{-1}(R(f(x), f(y)))$$ where $\overline{F}$ denotes the algebraic closure of $F$ and $f^{-1}(x) = (-dx + b) / (cx - a)$ is the inverse of $f$.
Theorem 1. Let $F$ be any field. Then any nonconstant associative rational function in $F(x, y)$ is equivalent to exactly one of $x$, $y$, $x + y$ and $x + y + xy$.
Thus there is no two-variable real rational function that is associative, not commutative, and not a projection.
Further related work suggested in the comments: Associative formal power series in two indeterminates (2013).