Does substitute $\lambda$ with matrix $A$ in a polynomial conflict with the Axiom of Substitution? This seems to be an elementary question, gonna ask it anyway. 
Suppose that $A$ is a square matrix, and that $p(x)$ is its characteristic polynomial, we know that 
(1) $p(x) = \det(xE - A)$
We also know that
(2) $p(x) = x^n + a_{n-1}x^{n-1}+...+a_0$
Now, from (1), we deduce that $p(A) = zero$, where "zero" is the number 0.
From (2), we will get $p(A) = ZERO$, where "ZERO" is the zero matrix.
I know I am wrong,  so...where I misunderstood? 
Would be appreciate if you go into the details. 
Thanks.
Edit
I thought that what I was asking is obvious: you substitute the $x$ with $A$ in both (1) and (2), you should get equal results, since (1) and (2) is equal, this follows from the substitution property of the equality. But as argued in the question, we now get different results, so something must be wrong.
 A: Why should anybody believe $p(X)=\det(XI-A)$ to be true for matrix $X$? In fact, it's not.
The assertion $p(A)=0$ does not mean that the determinant of $\det(AI-A)$ is zero, because that is not how we obtain the expression $p(A)$; rather, it means
$$``\det\begin{pmatrix}A-a_{11} & -a_{12} & \cdots & -a_{1n} \\ -a_{21} & A-a_{22} & \cdots & -a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ -a_{n1} & -a_{n2} & \cdots & A-a_{nn}\end{pmatrix}" ~:= A^n-(a_{11}+a_{22}+\cdots+a_{nn})A^{n-1}+\cdots$$
is zero, because it's this that faithfully imitates how we actually derive the polynomial expression $p(A)$, and it isn't immediately obvious why this will wind up being zero.
A: If you Let $M_{n}$ denote the linear space of $n\times n$ matrices over a field $\mathscr{F}$, and if $A \in M_{n}$, then it does make sense to define a function $p : M_{n}\rightarrow \mathscr{F}$. by $p(X)=\mbox{det}(X-A)$. There's nothing wrong with defining such a function, and clearly $p(A)=0$ for such a function, where $0\in\mathscr{F}$.
However, that's not the same as defining a polynomial $p(x)=\mbox{det}(xI-A)$ for a matrix $A$, say $p(x)=a_{0}+a_{1}x+\cdots a_{n}x^{n}$, and then defining $p(A)=a_{0}I+a_{1}A+\cdots a_{n}A^{n}$. For one thing the value of $p(A)$ is, in this case, an element of $M_{n}$ and not an element of $\mathscr{F}$. What is interesting is that $p(A)=0_{n}$, where $0_{n}\in M_{n}$, which is a statement of the Cayley-Hamilton Theorem.
A: After thought it for a while, I think I know what's going wrong, it's not on (1), but (2), (ultimately, it's on me, I guess).
When we say a matrix satisfies a polynomial 
$b_mx^m + ... + b_o$, 
what we mean is that 
$b_m A^m + ... + b_0 I = ZERO$, 
this is not a straightforward substitution, (there is a $I$ came out of nowhere), hence, if anything goes wrong, it won't affect the validity of the properties of substitution, because it is not a substitute operation. 
So, it really doesn't matter what it yields when we substitute $x$ with $A$ in (1), or even whether or not it is legit to do so, it won't lead us to $zero = ZERO$, for the reason I just stated in the above paragraph.
If you rewrite the formula as:
$ \det(xE - A) = x^n + a_{n-1}x^{n-1}+...+a_0$
you will clearly see that substitute $x$ with a matrix is not a legit operation, (you cannot add a matrix to the scalar $a_0$).
For any polynomial $f$, If you want to know what $f(A)$ is, you have to do it through (2), as pointed out by @copper.hat, because that's how we defined $f(A)$, and we haven't define it in a second way yet.
I think $f(A)$ is a bad notation, because it misleads us to think we can get $f(A)$ by substitute $x$ in the polynomial with matrix $A$.
