Article Two of the United States Constitution
The President is the military's Commander-in-Chief.  However, as part of the system of checks and balances in the Constitution, Article One says that only Congress can declare war. Still, the President can take actions like sending soldiers to certain places without needing Congress's approval, or a declaration of war.