Article One Section 8 of the Constitution gives Congress the power to...
"Provide for calling forth the militia to execute the Laws of the Union, suppress Insurrections and repel Invasions;
"To provide for organizing, arming and disciplining, the Militia, and for governing such Part of them as may be employed in the Service of the United States, reserving to the States respectively, the Appointment of the Officers, and the Authority of training the Militia according to the discipline prescribed by Congress;..."
Article 2, section 2 gives command of the militia to the President when the states militias are called out in service of the United States. Otherwise command of the militias is reserved to the states or localities.
The Bill of Rights, which includes the 2nd amendment, was adopted following the adoption of the Constitution. The 2nd did not void the direct instructions of the Constitution.
There is more to the story of course than just that though. The states maintained control of the militias, those that had them anyway. They were seen as part of a bulwork against overriding authority from the central government. The right of individuals to own and have arms was viewed in a similar way, as a part of defense against corrupt officials as well as for general self defense, defense of the community, for hunting, sporting etc.
For Americans long before the Revolution, disarming the population meant helplessness in the face of corrupt government officials. There has always been a healthy distrust of government and their cops and agents in this country. It's a good thing to recall why now and then if you have had occasion to forget.
It's also important though that the 2nd amendment does not stand alone. There is a reason it is included in the original bill of rights. It does not stand alone, which is good because alone it is quite weak when it comes to defending political rights.