As $A$ is non-derogatory, $\mathbb C^n$ has an $A$-cyclic basis $\mathcal B=\{v,Av,A^2v,\ldots,A^{n-1}v\}$. Let $Xv=c_0v+c_1Av+\cdots+c_{n-1}A^{n-1}v$ and let $f$ be the polynomial $c_0+c_1x+\cdots+c_{n-1}x^{n-1}$. Since $A$ and $X$ commute, $XA^kv=A^kXv=A^kf(A)v=f(A)A^kv$ for each basis vector $A^kv$. Therefore $X=f(A)$ on $\mathcal B$ and in turn, $X=f(A)$ on $\mathbb C^n$.
PS, In your comments I see that you are interested in a proof using Jordan forms. Denote by $J_m(\lambda)$ a Jordan block of size $m$ for an eigenvalue $\lambda$. Suppose $A=J_{m_1}(\lambda_1)\oplus\cdots\oplus J_{m_r}(\lambda_r)$ where $\lambda_1,\ldots,\lambda_r$ are distinct. As you may already know, it can be shown that when $X$ commutes with such an $A$, it must be in the form of $X_1\oplus\cdots\oplus X_r$ where $X_i=g_i\left(J_{m_i}(\lambda_i)\right)$ for some polynomial $g_i$.
It remains to construct a polynomial $f$ from $g_1,\ldots,g_r$ that makes $X=f(A)$. For each fixed $i$, let $p_i(x)=\prod_{k\ne i}(x-\lambda_k)^{m_k}$. Since all $\lambda_i$s are distinct, $p_i$ and $(x-\lambda_i)^{m_i}$ are coprime. Therefore, by Bézout's lemma, there exist two polynomials $a_i$ and $b_i$ such that
$$
a_i(x)p_i(x)+b_i(x)(x-\lambda_i)^{m_i}=1.
$$
It follows that $(a_ip_i)\left(J_{m_j}(\lambda_j)\right)$ is equal to $I_{m_i}$ when $j=i$, or $0$ when $j\ne i$. Therefore
\begin{aligned}
(a_ip_ig_i)(A)
&=(a_ip_ig_i)\left(J_{m_1}(\lambda_1)\right)
\oplus\cdots\oplus
(a_ip_ig_i)\left(J_{m_r}(\lambda_r)\right)\\
&=0\oplus\cdots\oplus0\oplus\underbrace{X_i}_{\text{$i$-th}}\oplus0\oplus\cdots\oplus0.
\end{aligned}
Consequently, $X=\sum_{i=1}^r(a_ip_ig_i)(A)$.