In a polynomial $p(x)$, the $x$ is a placeholder. That is, all that matters for polynomials are the positions of the coefficients and the rules to add and multiply polynomials.
A polynomial function is precisely that, a function, that evaluates over some ring.
The two notions do agree on $\mathbb R$ and $\mathbb C$, but they do not over other fields.
As an example, let $K=\mathbb Z_3$. Consider the polynomials $p,q\in K[x]$, where
$$
p(x)=1+x^2,\ \ q(x)=1+x^4.
$$
Then of course $p,q$ are different as polynomials. But they are equal as functions:
$$
p^\sim(0)=1=q^\sim(0),\ \ p^\sim(1)=2=q^\sim(2),\ \ p^\sim(2)=2=q^\sim(2),\ \
$$
so $p^\sim=q^\sim$.
For your last equality, note that the left-hand-side consists of doing the formal product of $f$ and $g$ and then replacing $x$ with $t$. While the right-hand-side consists of replacing $x$ with $t$ and then doing the formal product. It should be clear that both things achieve the same. Just writing $f$ and $g$ in terms of their coefficients and power of $x$ and writing both sides should make it apparent that they are equal.