First off, all skippers would have been well trained in how A.S.W. is conducted and how Sonar works, so check out Im Going Down's link.
In effect, the I.J.N. escorts are using active sonar all of the time, so if you get close enough to them (that is inside their detection field), they'll spot you no matter how quiet you are - or what profile you present to them.
In real life you would be able to hear their pings for several miles, but in this game, you only year them if you are very close.
As for passive sonar, it seems like you're already doing all the right things.
Generally I follow all of the advice mentioned above . Come in from the side - perpendicular to the lead escort's track, 1000 to 1500 yds. off. Get 20' below the thermal (no need to go deeper). Order your sonar-guy to follow the closest warship, then pop back up to periscope depth as soon as he crosses your bow.
Once you're behind an escort, you can do doughnuts at flank speed and he won't hear you (though any of his buddies following will - and, um, in TMO some merchants are also equipped with hydrophones

).
Oh. and in my experience, sea conditions have the biggest effect on how well the escorts can hear. Storms are a royal pain most of the time, but they do make you very hard to detect and track.