Submarines do not fight against air units.
Everything else - transports, subs, carriers, destroyers, battleships - do. Of course, transports have no “attack” value, but transports can defend.
A battleship that is NEXT to a sea zone or land zone in which fighters are involved takes NO PART in that combat. (unless for battleship bombardment, which you already know about). So if you have a sub in one sea zone and fifty battleships in the next sea zone over, the lone enemy fighter that attacks your sub is perfectly safe.