In the beginning of the war U-boats had little to fear from allied aircraft. Only 2 U-boats were lost to aircraft during 1939-1941 but in 1942 alone 31 boats were lost to them. A sign of things to come.
The aircraft eventually drove the U-boats submerged and forced them to stay there for extended periods of time thus greatly reducing their operational efficiency.
This strategic victory was not without loss as can be seen in the table here below; more than 120 aircraft and hundreds of men were lost in the fierce battles between the U-boats and their pursuing aircraft. In a number of cases there were no survivors from either the aircraft or the U-boat. You should read more about the famous
Fight Back order as it attempts to explain perhaps the most critical phase of the entire battle, the summer of 1943.
bron
http://www.uboat.net/history/aircraft_losses.htm