@VictoryFirst
See Example 1 and Example 2 at pg. 59.
A Type XXI U-Boat unit operates under regular OOB Submarine rules - unless mentioned at pg 59.
If the Type XXI unit withdraws from combat after the first shot, this happens before any enemy unit can return fire.
If the Type XXI unit stays in the sea zone to continue the attack after the first shot, the enemy units can return fire.
The defender must announce before combat begins if any Fighter units will scramble against the Type XXI unit (if at least 1 Destroyer unit is present) - this rule is OOB.
The German player does not have to declare anything before the attack whether or not the attack continues.