For this post, we will live in the realm of commutative rings with unit.
Suppose you have a ring $R$. Naively, a polynomial with coefficients in $R$ is something that takes something (usually called $x$) as an input and gives you something in return.
Usually, this something is an element of $R$ and you get an element of $R$ in return, but it turns out that it is convenient to leave this without saying, so that a polynomial can take elements of some set and turn it into an element of this same set.
However, since polynomial expressions include sums and products, the "domain" of the polynomial cannot be any set: it should be a ring. Moreover, the coefficients of the polynomial are elements of $R$, so the "domain" cannot be any ring: it also has to be a ring in which makes sense to multiply by elements of $R$. Technically, if you have a ring $S$, the idea of multiplication by elements of $R$ is encoded in the form of a ring homomorphism $\phi:R\to S$. Then for any $r\in R$ and $s\in S$ we can define the product $rs$ as $rs=\phi(r)s$. Such a pair $(S,\phi)$ is called an $R$-algebra.
Finally, we want to be able to perform operations on the polynomials even before evaluating them, including multiplication by elements of $R$. This means that our set of polynomials needs to be a ring and an $R$-algebra as well. Moreover, for any element $s\in S$ and any polynomials $p,q$, we want $(p+q)(s)=p(s)+q(s)$ and $(pq)(s)=p(s)q(s)$: that is, we want the evaluation $p\mapsto p(s)$ to be a ring homomorphism that respects the $R$-multiplication. Hence we get the following idea of a definition:
Given a ring $R$, we want to have and $R$-algebra called the polynomial ring $R[x]$ that satisfies the following property: for any $R$-algebra $S$ (this is, a ring in which "multiplication by elements of $R$ makes sense") and any element $s\in S$, we have an evaluation map $\operatorname{ev}_s:R[x]\to S$ which is a ring homomorphism respecting the $R$-multiplication, such that the polynomial $x\in R[x]$ gets mapped to $s\in S$. Moreover, the evaluation homomorphism should be unique.
It turns out that the usual definition of $R[x]$ as some formal sums and products satisfies this definition; even more: this $R[x]$ is the unique (in a suitable sense) $R$-algebra satisfying the definition.
For the more abstractly minded people, this post means that for any $R$-algebra $S$ there is a one-one correspondence
$$\left\{\text{elements of $S$}\right\} \leftrightarrow
\left\{
\overset{ \displaystyle\text{ring homomorphisms} }
{
\underset{\textstyle\text{respecting $R$-multiplication}}
{R[x]\to S}
}
\right\}$$
And for you categorists, the upshot is that the polynomial ring $R$ is the free commutative $R$-algebra on the one-element set.