Expand the RHS as a polynomial expansion, treating entries of $A$ as constants, and entries of $\epsilon X$ as the variable.
We see that $\det(A)$ cancels out with $\det(A)$, so there is no constant term.
What is the the linear term $\epsilon$? For each entry $\epsilon x_{i, j}$, we have to multiply with non X terms (since those have $\epsilon$ involved), which leaves us only with the cofactor of matrix A (determinant of matrix A with row i column j removed), which is the entry $adj(A)_{j,i}$ (Note that the indicides are reversed because we took the transpose of the matrix.) Thus this contribution is $\epsilon x_{i, j} adj(A)_{j,i}$. It remains to show that the sum of the coefficients of these linear terms from each of the $\epsilon x_{i, j}$ is indeed $tr( adj(A) X)$. The simplest explanation would be to just check that the matrix multiplication works, and gives us what we want:
$$ tr ( adj(A) X) = \sum_j \sum_i (adj(A)_{j, i} X_{i,j}). $$
What are the rest of the terms? They each have $\epsilon ^k$ where $k\geq 2$ in them, so we write them as $O(\epsilon ^2) $.