The two-house legislature was one embodiment of "checks and balances," Madison's overall philosophy that dividing power widely among different organizations was the best way to protect against tyranny. He figured people could be relied on to protect their turf, so that imperfect people would protect against other people who might abuse power.
The fact that it is two houses is the result of the so-called Great Compromise. At the constitutional convention, the big states thought they should have more representation in the legislature in view of their larger populations. The smaller states claimed this would mean a couple large states could dominate the entire country. The result: a classic compromise where everybody gets something they want but nobody "wins."