Because after the first
fork you have two processes both printing the
1 line: Both the parent and the child process executes that statement.
It might be clearer if you also printed
rc on that line as well:
printf("from 1: %d %d\n", pid, rc);
With the example pids from the question, the above should print
from 1: 5890 5891 from 5: 5890 from 1: 5891 0 ...