Let $A,B$ be $R$-modules. The direct sum $A\oplus B= \{(a,b) | a\in A, b\in B \}$ is a module under component wise operations: $(a_1,b_1)+(a_2,b_2)=(a_1+a_2,b_1+b_2)$ and $r(a,b)=(ra,rb)$.
This extends to a direct sum of finitely many $R$-modules. However, for a direct sum of infinitely many $R$-modules, there is a further requirement that elements have all but finitely many components equal to $0$.
The condition is equivalent to the property that there is some cardinal $\kappa$ such that every left $R$-module is a direct sum of modules with at most $\kappa$ generators.
Theorem 2 of
Warfield, R. B. jun, Rings whose modules have nice decompositions, Math. Z. 125, 187-192 (1972). ZBL0218.13012.
shows that the commutative rings with this property are precisely the Artinian principal ideal rings.
For not necessarily commutative rings, Theorem 2.2 of
Griffith, P., On the decomposition of modules and generalized left uniserial rings, Math. Ann. 184, 300-308 (1970). ZBL0175.31703.
shows that all rings with this property are left Artinian.
There is a property of rings called (left) pure semisimplicity, which has several equivalent definitions. Section 4.5 of
Prest, Mike, Purity, spectra and localisation., Encyclopedia of Mathematics and its Applications 121. Cambridge: Cambridge University Press (ISBN 978-0-521-87308-6/hbk). xxviii, 769 p. (2009). ZBL1205.16002.
gives a good survey, including such results as:
(Theorem 4.5.4) A left pure semisimple ring is left Artinian, and every left $R$-module is a direct sum of indecomposable finite length indecomposable modules.
(Theorem 4.5.7) $R$ is left pure semisimple if and only if every left $R$-module is a direct sum of indecomposable modules, if and only if there is a cardinal $\kappa$ such that every left $R$-module is a direct sum of modules of cardinality less than $\kappa$.
(Note that one consequence of all of this is that if every left $R$-module is a direct sum of modules with at most $\kappa$ generators for some $\kappa$, then in fact every left $R$-module is a direct sum of finitely generated modules.)
So a complete answer to the question is that the rings in question are precisely the left pure semisimple rings, although one might argue that this is just replacing the original condition with an equally mysterious one.
But there is a conjecture (the Pure Semisimplicity Conjecture, which is 4.5.26 in Prest's book) that the left pure semisimple rings are precisely the rings of finite representation type (i.e., for which every module is a direct sum of indecomposable modules, and with only finitely many indecomposables). It is known that every ring of finite representation type is left pure semisimple. Also, "finite representation type" is a left/right symmetric property, so if the conjecture is true then pure semisimplicity is a left/right symmetric property.
Best Answer
Hint: Let $R=N=M=\mathbb{Z}$. There are many $(x,y)\in \mathbb{Z}\oplus \mathbb{Z}$ such that the submodule generated by $(x,y)$ is not the direct sum of submodules of $\mathbb{Z}$. Can you find some?
This works in much greater generality than $\mathbb{Z}$, of course.