Subs attack with torpedoes and the rules for torps are different than gunnery attacks.
Torps score hits when a ‘6’ is rolled and they cause the target to lose 2 hull points so the battleship does not have a defense factor like the armour rating vs torps. Keep in mind that there are a couple of special abilities that modify the damage a torpedo does, the two most common are torpedo defense or TD1 which removes one point of hull damage from a torpedo attack and most Japanese destroyers and cruisers have Long Lance torpedoes which actually cause 3 points of damage to the target.
There are some other special abilities (SAs) that give you a roll and a roll of 4+ will remove a point of hull damage and there are probably another couple but they escape me at the moment…either way, this is the base example of how submarines attack :)