I know this question is old, but I'll answer it.

This solution is wrong because it returns the max depth of the left, and the right, respective from the root only.

What about if our solution lies elsewhere?

a
/ \
c b
/ \
e f
/ \ / \
g h i j
/ \
k l

If we only did the max of the left + right, we'd get 4 + 1, so 5, but it's pretty clear the bigger route is down on the left side, through 'c'.

Basically at each node we have 2 actions. We need to look at both branches combined to see how they compare to the overall max thus far, and we need to contribute a left or right side, whichever is more, so the other nodes higher up in the tree can attempt to do the same calculation of the sum of their branches against the current max.

Another thing to note is we cannot return the value of both of a nodes branches (left + right), because then it might get calculated into another node's calculation of both of it's branches. We'd end up with forked routes which are invalid. That is the reasoning for most of these solutions hoisting a max value our of their functions.