What is the reason for the shape of a church building?

The reasons are cultural, religious and social as well. Take for instance Gothic shapes, where the cathedral reigns: it had very high ceilings and pinnacles in order to try to reach the heavens, while inside the painted glasses would create dancing colored lights when the sun shone through them, creating a mystic ambiance. Roman churches (not the ones in Rome, but the ones of the Roman Period), a couple of hundred years before than Gothic ones, were basically a fortress: very high windows and 15 inches thick walls, made not to impress but to stand against the barbaric invasions. Later on, during the Baroque period, to show off opulence course, as nothing was too good for God, and Mannerism characterized statues and images of Jesus and other saints as realistically possible as could be. It may sound boring, but Churches are actually GREAT to know about.