I'm not an expert; but I played one on television

, but here's what I do.
Remember that 0 on the sonar scope is always the front of the boat. The scope only shows bearing to the target relative to the direction of travel of the boat. i.e. relative bearing.
I make all my sonar sweeps during partols from PD, periscope depth. In my experience, there is no difference in sonar efficiency at deeper depths. Not realistic, but hey, it is a game.
Your ship's heading is 020. You detect a contact at 040 on the scope. Just add the ship's heading and the relative bearing, and you have the true bearing to the contact. (I know, let's not discuss the difference between true north and magnetic north.)
020 + 040 = 060 true. You steer 060 and the contact should now be at 000 on the scope. Dead ahead.
You are playing GWX, so the big white compass which slides in from the right of your screen is your best friend. It makes the math unnecessary.
The inner dial on the white compass is relative bearing, the outer dial is true. In the example above, just click on 040 on the inner dial and your ship will turn to 060.
To determine a rough direction of travel of your target, just listen for a few minutes. 5 - 15 minutes is ample for most contacts. I'll turn 45 - 60 degrees, whatever I feel like, toward his direction of travel, surface and run 15 - 20 minutes. Go to PD and listen again.
Rinse and repeat until your deaf sonarman has the contact.