The most important function that happens in a rocket engine is the conversion of high temp/pressure gases to high velocity gases. How does the combustion chamber help in this objective. Why cant the combustion take place in the nozzle itself, and probably we can have a much simpler geometry?
The purpose of the rocket engine is to generate a continuous net force in the direction that one desires the rocket to travel. For main rocket engines (in contrast to smaller directional-thrust engines) this is a net force with a directional vector that is parallel to the long axis of the rocket. The chemical reaction of the rocket propellant molecules releases chemical potential energy that is (largely) distributed as kinetic energy of the gas molecules within the reaction chamber.
Within the reaction chamber, a certain percentage of these molecules collide with the inner walls of the reaction chamber per unit time. If there is no opening in the walls of the reaction chamber, these collisions can not produce a net force that will result in acceleration of the rocket.
In any completely sealed container, there is always an equivalent inner surface area directly opposite of any other surface area. Any force per unit time that occurs at one point on the inner surface of the container due to collisions of gas molecules is cancelled out by equal force per unit time occurring one at a point on the inner surface that is located directly opposite of that point by collisions of other gas molecules. All of the forces within the container are cancelled out and there is no net force, so the container will not change its velocity. If it has no velocity, it will not acquire a velocity.
In order to create a net force within the container - and as a consequence generate a net acceleration to the container - there must be an opening in the walls of the container.
The surface area of the container that is removed to create this opening is no longer present to provide collisions of gas molecules that would cancel out the force of collisions of gas molecules on the surface area that is directly opposite of the opening. The result is that there is a net force on the inner wall of the container that is directed 180 degrees away from the opening in the container.
Enlarging the opening in the container increases this net force since this removes additional surface area that was cancelling out force on the opposite area of the container.
Therefore - for a rocket engine - one wishes to maximize the size of the opening in the wall of the reaction chamber that is directly opposite of the direction that one wishes the rocket accelerate. If many other factors did not effect the performance of the rocket engine there would be no need to construct a nozzle. or one could simply call the hole in the reaction chamber "the nozzle".
Other factors do effect the performance of the rocket. For instance, one wishes to create the highest possible temperature within the reaction chamber. Many of these other factors affecting rocket engine performance can be optimized by constructing a well-designed nozzle rather than a simple hole in the reaction chamber.
So the role of the reaction chamber is not simply to create a volume where the chemical reaction of the rocket propellant can occur, but to create the largest surface area that gas molecules can collide with in the direction one wishes the rocket to accelerate and to create the largest hole in the chamber in the opposite direction that one wishes the rocket to accelerate. If combustion occurs within the nozzle there is a much smaller inner surface area for collisions to occur in the desired direction.
Interestingly, the most powerful rocket - by far - that we could begin building today has no reaction chamber and no nozzle.
A rocket that has a large supply of small thermonuclear bombs ("hydrogen" bombs) could eject these bombs, one at a time, from the back of the rocket. The bomb could then be detonated a short distance behind the rocket. If a large plate (a pusher-plate) is located at the end of the rocket, then a significant fraction of the force of the thermonuclear explosion can be applied to the surface area of the plate and the rocket will accelerate away from the explosion. This process can be continued as long as the supply of thermonuclear bombs lasts.