What is the definition of direct sum of submodules?

The ("external") direct sum of modules $M_i$ is defined as a subset of the Cartesian product of the $M_i$.

Now, there is another thing called the "internal" direct sum of submodules of a module. This is usually defined as the submodules summing to the whole module, and having the property that each component intersects the sum of others trivially. It amounts to each element having a unique representation as a sum of elements from each submodule.

The two are related this way: if you decompose $M$ as an internal direct sum of submodules $M_i$, the internal direct sum is isomorphic to an "external" direct sum via the map $m_1+m_2+\ldots \mapsto (m_1,m_2,\ldots)$.

Conversely, every decomposition of a module as a direct sum of other modules corresponds to an internal decomposition. You just look at the images of the components of the decomposition inside your module, and they form a family of submodules that defines an internal decomposition.

So you see the two are basically the same, it's just that one emphasizes working with tuples of elements in the Cartesian product, and the other works with sums of elements inside the module.