In the WW II movies the theme is the subs sneak up on the convoy, launch a few torpedoes at the transports, and dive when the escorts attack.
If they survive the depth charges, they do it again.
Why wasn't the first attack against the escorts? Especially once the wolf packs started operating I would think they could launch concerted attacks against the escorts. Then, if they were successful, the transports would be unprotected and could be attacked at will until they came within range of air cover.
(I'm Canadian so taking this opportunity for a tip of the hat to the Canadian navy - the 3rd largest in the world by the end of the war.)
U-boats did attack escorts. Between 1939-45, a total of 105 British escorts (destroyers, frigates, corvettes, sloops, minesweepers and escort carriers) were sunk by torpedoes, with another 36 heavily damaged. While some of these ships were hit by air-dropped or surface-launched torpedoes, the vast majority were sunk by submarine torpedoes. There were several reasons why the strategy you outline would be less efficient than what actually happened. Escorts were typically faster and more manoeuvrable than the merchant ships they were protecting (and kept better lookouts). As such, it was much more likely that an escort could dodge an incoming torpedo. To ensure a similar rate of hits per attack between merchants and escorts, more torpedoes would have to be fired in each attack; this is highly inefficient from a logistical standpoint. This could be made more efficient by the use of acoustic homing torpedoes, but these only became available from 1943, and could be confused by the use of decoys.
It's also worth noting that in both the First and Second 'Happy Times', when U-boats were at their most effective, escorts were few and far between. In the case of the First Happy Time, in the late summer and autumn of 1940, the RN only had enough escorts to protect convoys in the waters around the United Kingdom, and even then, only lightly. The typical convoy might have only a single destroyer and a sloop or corvette to protect it. This escort would only join convoys heading to the UK at 15^o West, and leave convoys heading west at the same point. This meant that most ships were crossing the Atlantic unescorted, protected only by the fact that convoys were small, hard-to-find targets. The Second Happy Time, in early 1942, meanwhile, was enabled by the fact that American coastal shipping was neither organised into convoys, nor escorted. They were easy pickings for U-boats that could reach the American coast. As should be clear, it was much easier in both cases for U-boats to attack merchants than their non-existent escorts.
Attacking only the escorts until every escort had been sunk also does not make sense if you think about what the goal of the U-boats was: to starve Britain into submission and to prevent it building up stocks of munitions, food and equipment. Every merchant ship that reached Britain represented an addition to those stockpiles. Not sinking merchants in favour of sinking escorts made the task of starving Britain to submission harder in the long run, as it meant far more ships would be arriving in the early part of the war. It's also worth noting that attacks on an unescorted or lightly escorted convoy were by no means certain to wipe it out.