Indeed, there were many such radars installed and used but they were in their infancy during early WW2. A submersible can only be seen by radar when it is on the surface, and the flat sheets and angular uncoated metal constructions of the time (covered in surface protrusions) were probably much easier to detect than any modern type of submarine or warship built with radar profile in mind, even though modern ships would be much larger and higher above the water than a sub deck and tower. The surface of the sea is hardly flat, if it were, it would probably be incredibly easy to detect a WW2 sub with a very simple modern radar…
However, the sub had to be on the surface. Early in the war, subs often attacked on the surface, to save power for the defensive and cruise, to use their deck gun instead of valuable torpedoes, to provoke surrender (by making their ominous presence obvious), and to maintain full situational awareness. This tactic would have been suicidal in the presence of fast escorts or airplanes. Early in the war, the Allies simply (esp US) did not internalize the devastating lessons of WW1 unrestricted sub warfare by having a plan in place to defend the US coast, much less slow ships travelling in the open sea.
One of the early problems was how to even deploy aircraft in the open Atlantic where land based planes could not reach (in the era before cheap drop tanks and aerial refueling). While there were substantial developments in Fleet Carriers, these large ships are too powerful and expensive to be used to escort merchant shipping. They even had to mount 1 time use spitfires without floats onto regular ships with an explosive catapult. The pilot would attempt to intercept the sub or raider then ditch in the sea near his ship to be recovered. Most ships smaller than a cruiser would not have dedicated float planes.
As the war progressed, escort carriers and seaplanes, and radar equipped land based bombers began to cover the gap.
Also, while radar would allow you to know precisely where a sub was on the attack, more sweeping methods were needed to determine where the subs were, in general. These included intercepting and triangulating radio transmissions from the subs; once the german subs were equipped with airborne detection radars, the active signals from these radars could be tracked with complementary allied equipment. Also, once the enigma code and naval codes were well known, very early in the war, the german spy network was completely compromised by the allies (especially the very sloppy methods of the Abwehr (german fleet intel), the Allies came to know when and where the Germans would attack, permitting them to anticipate where the subs would be and where they would be heading.
They also came to understand, I think, Hitler’s disdain for sea power. This meant that the Kriegsmarine wasted their powerful surface ships in pyrrhic engagements, failed to attain any strategic sea power, and instead began to rely entirely on the subs as a method of suppressing the allies economically (as opposed to bombing or blockading them). Because so much reliance was placed on this strategy, defeating it was simple; kill all the subs.
So yes, by the end of the war, there were abundant resources and methods for finding subs on or below the surface, and instead of allowing them to crash dive and escape, many of them were hunted by coordinated teams until their power ran out and they were forced to surface or surrender. Very few of the German subs that entered the Med through the Gibraltar current made the return journey. The effectiveness of submersibles as a weapon went from 10 kills per sub lost in 1941 to 2 subs lost for every kill at the end of the war.