Given this tree:
[A]
/ \
[B] [C]
maxDepth will be called for [B] with NULL, and for [C] with NULL, both return zero and so the recursive call ends up returning 0+1.
If you had a node [D] under [C] then the call to [D] maxDepth will return NULL and D will return 0+1, then the recursion will keep scaling up and [C] will receive 0+1 and will some +1, returning a maxDepth of 2 which is bigger than the depth of the branch that holds [B] which is 1 so maxDepth of 2 is returned from the complete recursion.