Even though this is a question about history, I'd suggest you post this in perhaps /r/architecture or /r/math as well to get a more in-depth answer to the why.
In short, the reason they chose the pyramid form is because it's durable. When it comes to structural integrity, a pyramid form is about the best available because of how forces work in a structure. A tetrahedron would be an even better form to build the pyramids in (from a purely durable perspective) but a pyramid has the advantage of being square, which means that it's easier to align with the way the sun rises and descends (important in Egyptian religion). The stone blocks in the pyramids were also joined together through convexes and concaves, which is easier to do if the structure has a square base than if it's triangular.