In Euclidean space $ \mathbb{R}^n $, let $ X_j=\frac{\partial}{\partial x_j} $, and for every $ X, Y\in\mathfrak{X}(\mathbb{R}^n) $, if $$ X=\sum_{i}f_iX_i=(f_1, f_2, \cdots, f_n),\quad Y=\sum_{j}g_jX_j=(g_1, g_2, \cdots, g_n), $$ then \begin{align*} \nabla_XY&=\sum_jX(g_j)X_j+\sum_{i, j}f_i\nabla_{X_i}X_j=\sum_jX(g_j)X_j\\ &=(X(g_1), X(g_2),\cdots, X(g_n))\\ &=\operatorname{d} Y(X). \end{align*}
This is from my textbook. I don't understand why $ (X(g_1), X(g_2),\cdots, X(g_n))=\operatorname{d}Y(X) $? ($ \operatorname{d} $ is the tangent map).
In $M=\mathbb{R}^n$ we have the global chart given by the identity map $\phi:x\in M \mapsto x \in \mathbb{R}^n$. For every point $p$ in $M$ we have the basis of the tangent vectors given by this chart $\frac{\partial}{\partial \varphi_i}|_p$ with $1\leq i \leq n$. They are the usuar directional derivatives, $\frac{\partial}{\partial \varphi_i}|_p=\frac{\partial}{\partial x_i}|_p$. So for every smooth function $f:M\to \mathbb{R}$ and for every $i$, we have $\frac{\partial}{\partial \varphi_i}|_p(f)=\frac{\partial f}{\partial x_i}(p)$. In your notation, $X_i=\frac{\partial}{\partial \varphi_i}|_p$.
Every smooth vector field $X$ in $\mathfrak{X}(M)$ can be writen univocally as $X=\sum_i^ng_i\frac{\partial}{\partial \varphi_i}$ where $g_i:M\to \mathbb{R}$ is smooth and is given by $g_i(p)=X_p(\varphi_i)$ for every $i$. So we have an isomorphism $$ X \in \mathfrak{X}(M)\mapsto (X(\varphi_1),\ldots,X(\varphi_n)) \in \mathcal{C}^\infty(M,\mathbb{R}^n) $$ with inverse $$ (g_1,\dots,g_n) \in \mathcal{C}^\infty(M,\mathbb{R}^n) \mapsto \sum_i^ng_i\frac{\partial}{\partial \varphi_i} \in \mathfrak{X}(M) $$
Under the identifications above, consider a smooth vector field $Y=(g_1,\ldots,g_n)$. It is just a smooth function $\mathbb{R}^n\to\mathbb{R}^n$ so you can compute its differential map (or tangent map). For every $p$ in $M$, $d_pY: T_pM \to T_{Y(p)}\mathbb{R}^n$ is given by $d_pY(X_p)(f)=X_p(f\circ Y)$ for every $f$ in $\mathcal{C}^\infty(M)$. We can again use the identifications $T_pM\cong \mathbb{R}^n$ and $T_{Y(p)}\cong\mathbb{R}^n$. Under these identifications $d_pY$ is just the linear endomorphism of $\mathbb{R}^n$ with the differential matrix of $Y$ at $p$ as associated matrix. That explains $(X(g_1),\ldots,X(g_n))=(dg_1(X),\ldots,dg_n(X))=dY(X)$.