Let $A\in \mathbb{R}^{n\times n}$ with $A\cdot A^{\star}=A^{\star}\cdot A$ and $U$ unitary, i.e. $U^{\star}\cdot U=U\cdot U^{\star}=I$, with $U^{\star}AU=\text{diag}(\lambda_1, \ldots , \lambda_n)$, where $\lambda_k$ are the eigenvalues of $A$. Let $f(z)=\sum_{k=0}^mc_kz^k$.
I want to show that the matrix $f(A)$ has the eigenvalues $f(\lambda_k), \ k=1, \ldots , n$.
$$$$
I have done the following:
$$f(A)v_j=\left (\sum_{k=0}^mc_kA^k\right )v_j=\sum_{k=0}^mc_kA^kv_j=\sum_{k=0}^mc_k\lambda_j^kv_j=\left (\sum_{k=0}^mc_k\lambda_j^k\right )v_j=f(\lambda_j)v_j$$
But in this way I haven't used any given information about the matrix $A$. So, have I done something wrong?
You proved correctly that every $f(\lambda_k)$ is an eigenvalue of $f(A)$, but you did not prove that it has no other eigenvalues. That's where the other hypothesis are needed.