I am trying to figure out the logic as to why finding $D(e^x), D(xe^x), D(x^2e^x)$ gives the column vectors for $A$.
I tried to work backwards by plugging in a $f$ which would be some vector in the span of $e^x,xe^x.x^2e^x$ into $D(f)= Af$ but I don't see how a matrix $A$ can be multiplied by a function $f$ to get the derivative.

The way one builds a matrix from a linear operator $T$, say on a dimension $3$ vector space, is $$ A_T=\begin{bmatrix} \vert&\vert&\vert\\T(e_1)&T(e_2)&T(e_3)\\\vert&\vert&\vert \end{bmatrix} $$ That is all that is going on here.
To see why, note that $A_T(e_i)=T(e_i)$.