Stalin was on the allies' side.
The "good" allies are invading from the west. The Soviets are "liberating countries" from the east. Countries like Poland and Lithuania. Keep these names in mind.
After the war, Germany (and Berlin) was divided in occupied zones.
US
British
French
Soviet
Meanwhile, we're still at war with Japan.
Russia starts invading Korea, Manchuria and so forth. Keep these names in mind along with the ones earlier.
So, eventually, WW II ends. On both fronts.
The Soviets turn most of the countries they've "liberated" into satellite states. Recall those names?
1947, President Truman institutes the Truman Doctrine. The US will "...support free people who are resisting attempted subjugation by armed minorities or by outside pressures..."
The US institutes the Marshall Plan.
The London Conferences are held. A West Germany government is to be built.
The Soviets blockade Berlin.
The Germans under Soviet rule see how much better the Germans in the west live under the Marshall Plan and start moving there. Lots of them move.
The Soviets lock down the borders.
And so forth.
The IMPORTANT item to note is the Truman Doctrine (of which the Marshall Plan was the economic implementation).
No, the division of Germany was NOT to punish the Germans. If you don't believe that, check out the literature on the London Conferences (and London Plan) and the Truman Doctrine.