Why do rocket engines have a throat?

The whole point to the throat is to increase the exhaust velocity. But not just increase it a little bit -- a rocket nozzle is designed so that the nozzle chokes. This is another way of saying that the flow accelerates so much that it reaches sonic conditions at the throat. This choking is important. Because it means the flow is sonic at the throat, no information can travel upstream from the throat into the chamber. So the outside pressure no longer has an effect on the combustion chamber properties.

Once it is sonic at the throat, and assuming the nozzle is properly designed, some interesting things happen. When we look at subsonic flow, the gas speeds up as the area decreases and slows down as the area increases. This is the traditional Venturi effect. However, when the flow is supersonic, the opposite happens. The flow accelerates as the area increases and slows as it decreases.

So, once the flow is sonic at the throat, the flow then continues to accelerate through the expanding nozzle. This all works together to increase the exhaust velocity to very high values.

From a nomenclature standpoint, the throat of a nozzle is the location where the area is the smallest. So a "U-shaped chamber with a nozzle" will still have a throat -- it's defined as wherever the area is the smallest. If the nozzle is a straight pipe then there is no throat to speak of.

Previous answers have focused on the fluid dynamics angle. However, you can also view it from a purely thermodynamic angle, viewing the rocket engine as a heat engine.

In order to get useful work (accelerated exhaust gases), you need some form of thermodynamic cycle with combustion followed by expansion. Due to conservation of energy, the amount of kinetic energy acquired by the gas will then be proportional to the amount of enthalpy (heat + pressure energy) that disapears as the exhaust gas expands and cools.

This means you want to maximize the temperature in the combustion chamber and minimize the temperature of the exhaust to maximize your Carnot efficiency. You ensure this by making sure that combustion happens before expansion, with a separate combustion chamber and expansion nozzle.

Furthermore, you want the gas to expand by as large of a factor as possible to minimize the exhaust temperature - and the expansion ratio is proportional to the area of the nozzle exit divided by the area of the nozzle throat. This means that from thermodynamic considerations alone, we can see that it is preferable to have a very tight throat and a very large exit area.

Fluid dynamics determine the exact details of nozzle shapes (de laval nozzles etc) that get the thermodynamic efficiency as close to the Carnot efficiency as possible, and whether the exhaust will actually expand or instead separate from the nozzle walls. But the need for a separate combustion chamber and nozzle is much simpler and can be understood without any knowledge of subsonic/supersonic flow.

As addition to @tpg2114 answer, I suggest also to read about de Laval nozzle and Rocket engine nozzle on wikipedia.

Some typical values of the exhaust gas velocity
for rocket engines burning various propellants are:

1.7 to 2.9 km/s (3800 to 6500 mi/h) for liquid monopropellants
2.9 to 4.5 km/s (6500 to 10100 mi/h) for liquid bipropellants
2.1 to 3.2 km/s (4700 to 7200 mi/h) for solid propellants

so that definitely makes sense to have nozzle)