The key is that there is a difference between a polynomial and a polynomial function.
Of particular importance is the notion of an indeterminate.
$1+z$ is a polynomial, with $z$ an indeterminate. $1+\frac{dy}{dx}$ is an evaluation of the related polynomial function at $\frac{dy}{dx}.$
The distinction between polynomial and polynomial function is somewhat (but not entirely) irrelevant when talking about polynomials with real or complex coefficients, because, given two such polynomials, they are equal if and only if the functions are always equal.
But with coefficients over finite rings, or rings with zero divisors, it is possible that two different polynomials can be associated with the same polynomial function on that ring.
The prototypical case is the ring $R=\mathbb Z/p\mathbb Z,$ where $p$ is prime. Then $f(x)=x^{p}$ and $g(x)=x$ are two different polynomials but they are equal as polynomial functions on $R.$
So mathematicians define a concept of "indeterminate." Given a commutative ring $R,$ we can define rings $R[x]$ or $R[x,y,z]$ or $R[x_i]_{i=1}^{\infty}.$ These rings are the rings of polynomials, with, respectively, indeterminate $x$, or $x,y$ and $z,$ or $x_1,x_2,\dots.$
In these rings, we often write polynomials like $f(x,y,z)=x^2+2y^2+3z^2,$ looking like function definitions, but the variables are not meant to represent specific values. They are abstractions.
Now, given a polynomial $f\in R[x_1,\dots,x_n],$ we also have a polynomial function $\overline f:R^n\to R,$ which assigns to each $(r_i)_{i=1}^n\in R^n$ a value equal to what you would think of as the evaluation of that polynomial on $(r_1,\dots,r_n).$
But even more generally, given a homomorphism $R\to S,$ where $S$ is another commutative ring, we also get a polynomial function $\overline f:S^n\to S.$
For a simple example, if $R$ is the ring $\mathbb Z$ of integers, and $S$ is the ring $\mathbb C,$ of complex numbers, then we can evaluate $f(x,y)=2x+4xy+y^2\in\mathbb Z[x,y]$ as a polynomial function of complex numbers.
So a single polynomial actually can define a lot of functions.
Rings of polynomials are interesting, because they are the "simplest" commutative ring which contains which contain $R$ and the indeterminates. This can be made rigorous by showing a certain "universal property," but you can think of it as the smallest commutative ring of expressions formed by elements of $R$ and the indeterminates, using $+$ and $\times$ as your only operation.
(Note that, if we have infinitely many indeterminates, each polynomial will still only be a finite expression, and thus cannot use all the indeterminates.)