There is an evident map $M_n(R)\to M_n(R[X_1,\dots,X_m])$, which is injective and a map of rings, so we can identify the elements of $M_n(R)$ with their images in $M_n(R[X_1,\dots,X_m])$. On the other hand, for each $i\in\{1,\dots,m\}$ let $\underline X_i$ be the element of $M_n(R[X_1,\dots,X_m])$ which is a diagonal matrix all of whose diagonal entries are $X_i$, so that $\underline X_i=X_i\cdot I_n$, with $I_n\in M_n(R[X_1,\dots,X_m])$ the identity matrix.
An element $A$ of $M_n(R[X_1,\dots,X_m])$ can be written in exactly one way as a finite sum $\sum_{i_1,\dots,i_m\geq0} a_{i_1,\dots,i_m}\underline X_1^{i_1}\cdots \underline X_m^{i_m}$ with the $a_{i_1,\dots,i_m}$ elements of $M_n(R)$. That's where the map comes from.
For all $i_1,\dots,i_m\geq0$ and all $i$, $j\in\{1,\dots,n\}$, the $(i,j)$th entry of the matrix $a_{i_1,\dots,i_m}$ is the coefficient of $X_1^{i_1}\cdots X_m^{i_m}$ in the $(i,j)$th entry of $A$.
Alternatively, let us write $S=R[X_1,\dots,X_m]$. The ring $M_n(S)$ is the endomorphism ring of the free left $S$-module $S^n$ of rank $n$. One can check that there is a canonical isomorphism $\hom_S(S^n,S^n)\to S\otimes_R\hom_R(R^n,R^n)$ and, since $\hom_R(R^n,R^n)\cong M_n(R)$, this tells us that $M_n(S)\cong S\otimes_R M_n(R)$ We are thus left with showing that $S\otimes_R M_n(R)\cong M_n(R)[X_1,\dots,X_m]$. It is in fact true that for all $R$-algebras $\Lambda$ we have an isomorphism $R[X_1,\dots,X_m]\otimes_R\Lambda\cong\Lambda[X_1,\dots,X_m],$ and we want this when $\Lambda=M_n(R)$. Can you do this?