Modern submarine-launched torpedoes are guided via a wire trailing from the torpedo back to the launching submarine. I assume the wire is connected to the submarine when the “fish” is loaded into a tube. But, how does the sub rid itself of the wire once the torpedo has exploded?
The wire (which is miles long) unspools from both the torpedo itself and the section that remains in the torpedo tube, which is called the “torpedo-mounted dispenser” (TMD). This is to reduce tension on the wire as the torpedo maneuvers and as the sub itself maneuvers after launch. The TMD is on the back end of the torpedo, and remains in the torpedo tube after launch.
The wire can be used to guide the torpedo; it also supplies information back to the submarine on what the torpedo itself is sensing. It often breaks during the torpedo’s run; at that point, the torpedo is on its own and it reverts to its own guidance system.
After the wire breaks (either due to the torpedo’s manuevers, the sub’s maneuvers, or when the torpedo explodes), the outer door of the torpedo tube is shut, which cuts off the wire. The TMD is then removed from the tube.