A general class of counterexamples is given by Exercises II.3.9 and II.3.10 of [Conway]; see references below.
Exercise II.3.9. Let $A \in \mathscr B(\mathscr H)$ and $\mathscr N = \operatorname{graph}(A) \subseteq \mathscr H \oplus \mathscr H$, that is, $\mathscr N = \{h \oplus Ah \, : \, h\in\mathscr H\}$. Because $A$ is continuous and linear, $\mathscr N \leqslant \mathscr H \oplus \mathscr H$. Let $\mathscr M = \mathscr H \oplus (0) \leqslant \mathscr H \oplus \mathscr H$. Prove the following statements: (a) $\mathscr M \cap \mathscr N = (0)$ if and only if $\ker(A) = (0)$. (b) $\mathscr M + \mathscr N$ is dense in $\mathscr H \oplus \mathscr H$ if and only if $\operatorname{ran}(A)$ is dense in $\mathscr H$. (c) $\mathscr M + \mathscr N = \mathscr H \oplus \mathscr H$ if and only if $A$ is surjective.
(Here the notation $V \leqslant W$ means that $V$ is a closed linear subspace of $W$.)
The proofs of the statements in the preceding exercise are straightforward. This exercise is followed, suggestively, by the following.
Exercise II.3.10. Find two closed linear subspaces $\mathscr M,\mathscr N$ of an infinite-dimensional Hilbert space $\mathscr H$ such that $\mathscr M \cap \mathscr N = (0)$ and $\mathscr M + \mathscr N$ is dense in $\mathscr H$, but $\mathscr M + \mathscr N \neq \mathscr H$.
Of course, the solution is to give an example of a Hilbert space $\mathscr H$ and an operator $A \in \mathscr B(\mathscr H)$ with $\ker(A) = (0)$ such that $\operatorname{ran}(A)$ is dense in $\mathscr H$, but $\operatorname{ran}(A) \neq \mathscr H$. Then choose $\mathscr M$ and $\mathscr N$ as in Exercise II.3.9, and the result follows.
A clear example of such an operator is the operator $A : \ell^2 \to \ell^2$ given by $e_n \mapsto \frac{1}{n + 1}e_n$, where $\{e_0,e_1,\ldots\} \subseteq \ell^2$ denotes the standard orthonormal basis. This choice of $\mathscr H$ and $A$ gives rise to a counterexample similar to the one given by Robert Israel.
Other, more complicated examples of this form exist as well, as t.b. shows us. (While his answer to the present question gets a little carried away with specifics, the more general construction is mentioned in his answer to another question.)
References:
[Conway]: John B. Conway, A Course in Functional Analysis (1985), Springer Graduate Texts in Mathematics 96.