Definition 1: Given $a_n,...,a_1,a_0 \in \mathbb{R}$, a polynomial function is a function $p:\mathbb{R} \rightarrow\mathbb{R} $ such that $p(x)=a_nx^n+...+a_1x+a_0$
Definition 2: The function $p:\mathbb{R} \rightarrow\mathbb{R}$ is a polynomial function if there exist $a_n,...,a_1,a_0 \in \mathbb{R}$ such that $p(x)=a_nx^n+...+a_1x+a_0$ for any $x$
The first definition is the one I've always used; the second comes from Linear algebra done right. Now, I can understand both of them, but I can't see why one would need to complicate matters with the second definition, which seems a little more difficult to me. What's the difference? Why use one or the other?
I still don't really know what you are trying to say with definition 1, but I suspect you are trying to ensure some sort of uniqueness of coefficients, and apparently define the degree of a polynomial. I think you missed the mark here, so here is a simple and correct way to define a polynomial, and it's degree.
Define a polynomial of degree $n\geq0$ to be a function $p:\mathbb{R}\to \mathbb{R}$ such that there exists $a_n,\dots,a_0\in\mathbb{R}$ with $a_n\neq0$ and $p(x)=a_n x^n+\dots a_1 x+ a_0$ for all $x\in\mathbb{R}$. Define a polynomial of degree $n=-\infty$ to be the zero function.
Define a polynomial to be any function which is a polynomial of degree $n$ for some $n$.
The coefficients are unique in the following sense: if any function $p:\mathbb{R}\to\mathbb{R}$ satisfies $p(x)=a_n x^n+\dots a_1 x+ a_0$ for all $x$ and also $p(x)=b_m x^m+\dots b_1 x+ b_0$ for all $x$, then without loss of generality we may suppose $n\leq m$, and defining $a_i=0$ for $i=n+1,\dots, m$ we may conclude that for $j=0,\dots,m$, $a_j=b_j$. The uniqueness statement may be proven and is not part of the definition.