Once, as a lark, I targeted a DD that was running perpendicular to my course that was around 11km away. (Yes, I was using autotargeting that time :p ) Needless to say I was shocked when it hit!
Targeting something moving away from you is a bear, especially if 1) it is more than 1,000 meters away (especially if you're using an electric torp), 2) aware of you and is zigzagging and/or 3) you're
directly behind it. Your only choices at that point is a torpedo set with a magnetic pistol.
If it's almost 2km away and you fire an electric torpedo, by the time the fish would manage to catch up it might run out of power, depending upon the target's speed.
If you're directly behind it, you have a very narrow attack angle. Any error at all will have it pass just to either side. It seems you're better off being at least 30 - 40 degrees to either side when you're behind, as that way the torpedo is more likely to pass under the target.
And if it's zigzagging . . . forget it. You almost have to be up its keester to manage a hit if the target is evading.
I'll admit, it's very frustrating to be so close to a juicy target but you wind up (for whatever reason) in a submerged stern chase with it.