If $M$ is a connected compact $2$-manifold, then it unknots in $\Bbb R^5$. More generally, $k$-connected $n$-manifolds embed in $\Bbb R^{2n-k}$, provided $k<\frac{n-2}2$, and unknot in $\Bbb R^{2n-k+1}$, provided $k<\frac{n-1}2$. This was proved around 1961 - by Roger Penrose, J.H.C. Whitehead, and Zeeman in the PL category; and by Haefliger in the smooth category. Later Zeeman and Irwin relaxed the metastable dimension restrictions in the PL result to codimension $\ge 3$ (see Zeeman's "Seminar on Combinatorial Topology").

On the other hand, the disjoint union of two $2$-spheres is a compact $2$-manifold. It definitely knots in $\Bbb R^5$ as detected by the linking number. That is the degree $\alpha$ of $S^2\times S^2\to S^4$, $(p,q)\mapsto \frac{f(p)-g(q)}{||f(p)-g(q)||}$, calling our link $f\sqcup g:S^2\sqcup S^2\to\Bbb R^5$. 
A nontrivial link is the Hopf link, whose components are the factors of the join $S^5=S^2*S^2$. Since $S^2$ unknots in $\Bbb R^5$, the exterior of one component is always homotopy equivalent to $S^2$, and the linking number is also the degree $\lambda$ of $p(S^2)\to S^5\setminus q(S^2)\simeq S^2$. [In different dimensions, where $\alpha$ and $\lambda$ are not numbers but homotopy classes of spheroids (more precisely $\alpha$ factors though a spheroid up to homotopy, upon killing the wedge), their relation is more interesting: $\alpha$ equals the suspension of $\lambda$ (up to a sign).]

By Haefliger's theorem (1963) that embeddings in the metastable range are classified by equivariant homotopy of two-point configuration spaces, the linking number for each pair of components is the only invariant of smoothly embedded $2$-manifolds in $\Bbb R^5$.
This recovers the result that connected surfaces unknot in $\Bbb R^5$; and additionally implies that there is nothing new for $3$-component links. [In contrast, there are the Borromean rings of three $3$-spheres in $\Bbb R^6$, whose nontriviality is detected e.g. by a nonvanishing triple Massey product in the complement. Thinking of the usual Borromean rings in $\Bbb R^3$ as lying in the three coordinate planes, one can similarly do three copies of $S^1*S^1$ lying in the two-factor subproducts of $\Bbb R^2\times\Bbb R^2\times\Bbb R^2$.]

Also smooth, PL and topological knot theories coincide for smooth $n$-manifolds in smooth $m$-manifolds in the metastable range $m>\frac{3(n+1)}2$ (this includes $2$-manifolds in $\Bbb R^5$). In more detail, Haefliger's classification theorem implies that if two smooth embeddings in the metastable range are isotopic (=homotopic through topological embeddings, possibly wild) then they are smoothly isotopic. Weber's PL classification theorem (1967) implies additionally that every PL embedding of a smooth manifold in the metastable range is ambient isotopic to a smooth embedding. Also it follows from results of Edwards and Bryant that an arbitrary topological embedding in codimension $\ge 3$ is isotopic to a PL embedding, and, from results of Bryant-Seebeck, that a locally flat topological embedding in codimension $\ge 3$ is ambient isotopic to a PL embedding.