The need for the Constitution grew out of problems with the Articles of Confederation, which established a "firm league of friendship" between the states, and vested most power in a Congress of the Confederation.
This power was, however, extremely limited — the central government conducted diplomacy and made war, set weights and measures, and was the final arbiter of disputes between the states. Crucially, it could not raise any funds itself, and was entirely dependent on the states themselves for the money necessary to operate.
Each state sent a delegation of between two and seven members to the Congress, and they voted as a bloc with each state getting one vote. But any decision of consequence required a unanimous vote, which led to a government that was paralyzed and ineffectual.
A movement to reform the Articles began, and invitations to attend a convention in Philadelphia to discuss changes to the Articles were sent to the state legislatures in 1787. In May of that year, delegates from 12 of the 13 states (Rhode Island sent no representatives) convened in Philadelphia to begin the work of redesigning government. The delegates to the Constitutional Convention quickly began work on drafting a new Constitution for the United States.