Question: > 
> I grant you with great pleasure the forgiveness you asked for.
> 
> 
> 

Is the position of ***with great pleasure*** grammatically correct?

Answer: 
No, it isn't - you need to say who had arrived at home. (KB)

If it was *you* who had arrived at home you would need to say when arriving home (FF)
No. Correct structure for a "when" clause is: [*when + **subject + verb-with-tense***]. This, however, is [*when + **verb-with-tense***], with no subject, so bad grammar.