To invert a tree, you swap the left and right children of the root. Then you invert the left subtree and the right subtree. The recursion does the rest. The base case is a null node. If the node is null, there is nothing to invert, so you return null.
If the node exists, swap its children, recurse on both, and return the node. This is tree modification in action. You are not only reading values. You are changing the structure of the tree itself.