Welcome to SubSim
I was having problems like these as well. I was close to Cuba in 1941 before the US entrance to the war and I saw a large tanker. It was very dark and since tankers don't appear so often I lunched 2 torpedoes. As it started burning and listing I've realised it was american, but there was nothing I could do by that point. So I've used the deck gun to send him down as soon as possible. A bit more than half an hour later a catalina spotted me and directed 2-3 destroyers towards me. It was the end. I was charged and bombed for more than 2 hours, until I was hit by a bomb on the conning tower. The U-boat exploded and I went to meet the maker
Moral of the story?? If you attack neutrals make sure they go down before they know what hit them