According to the definition, a scalar $\lambda$ is called an eigenvalue of an $n\times n$ matrix $A$ if and only if there is a nonzero vector $\mathbf{v}$ such that$$A\mathbf{v}=\lambda \mathbf{v},$$or, equivalently$$(\lambda I - A)\mathbf{v}=\mathbf{0},$$ where $I$ is the $n \times n$ identity matrix. Since $\bf{v}$ is a nonzero vector, we must have$$\det (\lambda I - A) =0\tag{*}\label{*}$$(Otherwise, the matrix $\lambda I -A$ would be invertible, which implies that we could multiply the equation by $\det (\lambda I- A)^{-1}$ and so$$(\lambda I -A)^{-1}(\lambda I -A)\mathbf{v}=(\lambda I - A)^{-1}\mathbf{0} \quad \Rightarrow \quad I \mathbf{v}=\mathbf{0} \quad \Rightarrow \quad \mathbf{v}=\mathbf{0},$$ which is a contradiction).
Conversely, An equation of the form \ref{*} in general is a polynomial of degree $n$, so by the fundamental theorem of algebra it has $n$ roots $\lambda _1 , ..., \lambda _n$. So we can write it as$$\det (\lambda I -A) =(\lambda - \lambda _1 ) \cdots (\lambda - \lambda _n). \tag{**}\label{**}$$
Each $\lambda _i$ must be an eigenvalue of the matrix $A$ because from $\det (\lambda _i I -A)=0$ we conclude that the matrix $\lambda _i I -A$ is non-invertible$\dagger$ and so there must be a nonzero $\mathbf{v_i}$ such that $(\lambda _i I -A)(\mathbf{v_i})=\mathbf{0}$$\ddagger$, which is equivalent to $A \mathbf{v_i}=\lambda _i \mathbf{v_i}$
Now, if we define the characteristic polynomial of a matrix $A$ as$$p(t)=\det ( A-tI),$$then we have$$p(\lambda )=\det (A-\lambda I)=\det (-(\lambda I-A))=(-1)^n\det(\lambda I -A)$$(We used the basic property of the determinant stating that$\det (cA)=c^n \det A$).
Thus, by applying \ref{**} we conclude that$$p(\lambda )=\det (A-\lambda I)=(-1)^n (\lambda - \lambda _1) \cdots (\lambda - \lambda _n).$$
Footnote
$\dagger$ This follows from the fact that if a matrix $A$ is invertible then there exists some matrix $B$ such that $AB=I$ so $$\det (AB)= \det (A) \det (B) = \det (I) =1 \quad \Rightarrow \quad \det (A) = \frac{1}{\det (B)} \neq 0,$$ so if the determinant of a matrix is zero then the matrix must be non-invertible.
$\ddagger$ This follows from the fact that if $Ax=0$ has only the trivial solution then the matrix $A$ must be invertible, so if a matrix $A$ is non-invertible, there must be a nontrivial soluttion for $Ax=0$. For more information, please see this post