The postwar zones of occupation covering Greater Berlin, which later hardened into East and West Berlin, were agreed by the Allies in September 1944 based on the city's municipal districts, as established in 1938. The original document lists the districts.
More detail in this previous question and answer.
The Prussian parliament created the Greater Berlin area on October 1st, 1920 by combining the original districts and outlying communities and estates under one city government. The city was divided into 20 districts (Verwaltungsbezirke). The Soviets took over the eastern 8 districts, the US the southwestern 6, the British 4 and the French 2 (taken from the UK's original 6). The occupation zones generally followed the district boundaries.
Oddly, the original 1920 act included 10 exclaves that were not within Berlin's contiguous border, but were under city administration. All 10 belonged to districts under the Western Powers. This meant that people of Steinstücken, the only exclave with permanent residents, were under US jurisdiction. But to get to work or school, they had to cross about 1km of Soviet-controlled (later DDR-controlled) territory and pass through checkpoints at each end (with varying amounts of harassment).
This was solved in 1972 when the DDR (East Germany) and BRD (West Germany) agreed on a small land exchange that created a narrow path of BRD territory between Steinstücken and the rest of the Zehlendorf district.