Understanding permutation of string

if taken string is abc how is b getting swapped with c while the return process because we have taken loop for i=j???

i am not much clear about your doubt but actually what happens is
a is swapped with a
b is swapped with b
c is swapped with c
recursion ends (abc)
b is swapped with c
…(acb)

This is how things are carried out in recursion.