Torpedoes, like naval mines, are weapons that are largely ignored until there is a naval conflict and warships have to face the potential use of mines and, worse, torpedoes. At that point it will be realized that efforts to create effective defenses against mines and torpedoes are not sufficiently abundant. Mines are less dangerous because they can be detected and neutralized. This requires precautions taken in advance, but if you want to avoid losses to mines you have to take the time to deal with them. Torpedoes are another matter. Mines are relatively cheap and plentiful. That means many nations have them and use them if there is a conflict and an opportunity to use the mines.
Torpedoes are more expensive than mines and more difficult to use. Torpedoes are different in many other ways. Their effective use requires very close proximity to the target. Damage is caused when the torpedo detonates via impact or from a magnetic detonator that triggers an explosion when the torpedo is close enough to the ship to inflict damage. In essence, a torpedo attack from a submarine hasn't changed much since World War II. You get in reasonably close, often within three kilometers, and you launch the torpedo. This cuts down the time one has to deal with the incoming threat.
Underwater sensors have a much shorter range for detecting incoming torpedoes. In order to reliably take out an incoming torpedo, one needs to see it. The "eyes" underwater usually consist of passive sonar - in essence, underwater microphones, with operators who try to pick out the torpedo in the whole underwater cacophony that includes whale songs, the ship's own engines, and other sounds of the sea. Active sonars can also be used, but, like radar, they also tell everyone where the ship using them is. Sonars have shorter ranges than radars, especially as submarines get quieter. Submarines are often considered to be the original stealth weapons.
There are some defenses against modern torpedoes, most of which are guided by internal sonar systems. Often these defenses are towed decoys, which are single use, as they induce the torpedo to detonate near them instead of the ship towing them. The first of these decoys was the Fanfare, which was later supplanted by Nixie. These decoys gave off acoustic signatures that mimic those of the ships towing them or those of larger vessels. The hope is that the torpedo will go after the decoy and not the real ship. These are known as "soft kill" systems. The problem is that not all torpedoes home in on acoustic signatures. Some home in on a surface ship's wake. This neutralizes decoys like Fanfare and Nixie.
Wake-homing is the most dangerous torpedo guidance system and the most difficult to deal with because it uses a passive sensor that detects a wake and then pursues the ship creating the wake. The lack of short-range torpedo detection and defense systems has made wake homing torpedoes the most dangerous variety. There are disadvantages. Wake-homing guidance means the torpedo is going to take longer to reach target ship and detonate where it will destroy or damage the propulsion and steering systems as well as cause the ship to take on water. This often causes the ship to eventually sink as well. The long approach time provides opportunities to attack the torpedo. Few ships are armed with the weapons and sensors needed to deal with an approaching wake-homing torpedo.
The United States has spent a lot of money trying to develop anti-torpedo sensors and defenses for its aircraft carriers and some submarines, like the Virginia-class SSNs. The navy is also spending a lot of money on CRAW (Compact Rapid Attack Weapon) torpedo defense system for carriers. CRAW has gone through several cycles of upgrades and improvements because the navy believes CRAW is the most effective, and potentially effective, torpedo defense systems yet developed. While meant for carriers, a version for Virginia-class SSNs is also being developed.
The Russians, who often face superior Western sensors in all manner of weapons, began developing hard-kill systems to deal with torpedoes. These were initially variants of the RBU anti-submarine rockets that carry depth charges in front of the ship or to any angle a torpedo might come from. The rockets carry an explosive warhead that disrupts torpedo guidance systems. To deal with this The Americans and British have developed a new twist on this concept, devising a system that will fire an anti-torpedo torpedo. A wake-homing torpedo might not be decoyed, but it also is unable to take evasive maneuvers, and can be induced to take a predictable path. This is called the hard-kill concept because it destroys or disables torpedoes and is ultimately the best way to deal with anything incoming, particularly if the incoming object has a big warhead.