This is probably the simplest recursive program that it is possible to write and it is therefore a stupid program in actual practice, but for purposes of illustration, it is excellent.
Recursion is nothing more than a function that calls itself.
It is therefore in a loop which must have a way of terminating. The function simply decrements the variable, prints it out in a message, and if the variable is not zero, it calls itself, where it decrements the variable again, prints it, etc. etc. etc. Finally, the variable will reach zero, and the function will not call itself again. That is not what actually happened, but it is a reasonable illustration for you to begin understanding what it was really doing.