Lets unroll the loop to explain easily
if(fork() == 0) //After here there are 2 processes
if(fork() == 0) //After here there are 4 processes
When a process calls fork(), a copy of that process is made (like a clone) and that copy (called a child) also starts execution from the point of call of fork (starts executing the following instruction). The only difference for these 2 processes is the return value of the fork -- which is 0 for the child one and non-zero for the parent (it will be the child pid). Thus in the given code, child only does the printing.
After first fork, we have 2 processes and one of them prints.
After the second fork, we have $2\times2 = 4$ processes, and 2 of them prints.
So, totally we get $1 + 2 = 3$ "hello".
Now, there is a catch here, as I told when fork is called a copy of the process is made. This includes every thing that is part of the process including file descriptors and buffers. So, if the output buffer is not flushed before fork, even that is copied to the child process and output gets printed more times than expected. A quick fix for this is to print "hello\n" than just "hello". (Still remember my B.Tech. day when a whole day was spent on this issue).