It was never really explained why Jaqen H'ghar ended up in the black cells at King's Landing, or what he was doing in Westeros in the first place. I'd like to think it was the Faceless Men's idea all along to train Arya and send her back home to do some good ol' killin' for the Many-Faced God.