There is no defense for a modern torpedo. You can’t outrun them and you can’t fool them.
Modern torpedoes are unlikely to be fooled by countermeasures. Once it’s on target it’s likely to get there. Worse, a single torpedo is likely to sink most ships.
It might take more than one to sink a carrier, but even one is going to cause major issues. That kind of shock is likely to cause leaks, trip off machinery, trip breakers, etc. If the crew is busy fighting fires – literally or figuratively – then they aren’t working their mission.
Ok, I’ve read the other responses and was surprised that no one mentioned how modern torpedoes work.
The last time torpedoes were used was WWII. At that time torpedoes were crude. They were designed to penetrate a ship and explode. I can’t speak for other countries torpedoes only US models. Modern US torpedoes are not designed to penetrate the side of its target. They are designed to explode under the center of its target thus breaking the targets keel.
Explosions in air are devastating but explosions in water are magnified by orders of magnitude over air explosions. This is due to the density of water versus air this would prove devastating to modern warships.
Warship construction has evolved in both design and materials over the centuries from the time of the Phonicians and Egyptians and Greeks to present day but the constant is that every ship of any size still is designed around and built upon a spine or Keel.
The thickness of that keel is proportional to the size of that ship. If you break a ships keel it has the same effect as breaking a persons back. It can no longer take the effects of water or engine torque and breaks apart.
That being said it is possible the an aircraft carrier might be able to take a torpedoes explosion under its keel only because of the size of the keel relative to the size of the completed ship versus the size of the explosive yield.

Look at the section at the bottom center of the section suspended and you’ll see 10 red sections with holes. Those are part of the keel from a Nimitz Class Super-carrier. Chances are that a torpedo could damage a Carriers hull/keel but probably not break it. And the designed compartmentalization would prevent a torpedo impact explosion from causing too much critical damage.
WWII US aircraft carriers took multiple torpedo hits and kept going. So while not desirable a modern aircraft carrier should be able to take a number of torpedo hits and still be able to carry out its purpose.
