Torpedoes have contact and magnetic fuses to detonate. The active or passive sonar simply allows the torpedo to get in to the zone in which its warhead will effect the target or to guide it on a collision course with the target. A passive homing torpedo would follow the noise its locked on to towards it source (the screw or reactor coolant pumps) then hit it detonating the torpedo since normally against submarines a contact detonator is used.
__________________
 
|