Our present military organizational structure is a result of the National Security Act of 1947. This is the same act that created the United States Air Force, and restructured the "War Department" into the "Department of Defense."
The Department of Defense is headed by a civilian; the Secretary of Defense, who is appointed by the President of the United States. Under the Secretary of Defense, there are three military departments: The Department of the Army, the Department of the Air Force, and the Department of the Navy. Each of these military departments are also headed up by civilians; the Secretary of the Army, the Secretary of the Air Force, and the Secretary of the Navy. These "service secretaries" are also appointed by the President.
There are five military branches: The Army, Air Force, Navy, Marine Corps, and Coast Guard. The Army is commanded by a four-star general, known as the Army Chief of Staff. The Army Chief of Staff reports to the Secretary of the Army (for most matters). The top military member in the Air Force is the Air Force Chief of Staff. This four-star general reports (for most matters) to the Secretary of the Air Force. The Navy is commanded by a four-star admiral, called the Chief of Naval Operations. The Marines are commanded by a 4-star general called the Commandant of the Marine Corps. Both the Chief of Naval Operations and the Marine Corps Commandant report (for most matters) to the Secretary of the Navy.
Note how I said they report "for most matters" to their respective service secretaries. These four "flag officers" also make up a group called the Joint Chiefs of Staff (JSC). The Joint Chiefs of Staff comprise the four Service Chiefs, the Vice Chairman of the Joint Chiefs of Staff, and the Chairman of the Joint Chiefs of Staff. The Chairman is nominated by the President and approved by the Senate (as are other general and flag officer positions). For operational matters (such as war or conflict), the JCS by-passes the individual service secretaries and report directly to the Secretary of Defense, and the President.
That leaves the Coast Guard. The Coast Guard does not fall under the Department of Defense. Until recently, the Coast Guard was under the Department of Transportation. Recent legislation has move the Coast Guard to the newly created Department of Homeland Defense. However, the Coast Guard is considered a military service, because, during times of war or conflict, the President of the United States can transfer any or all assets of the Coast Guard to the Department of the Navy. In fact, this has been done in almost every single conflict that the United States have ever been involved in. The Coast Guard is commanded by a 4-star admiral, known as the Coast Guard Commandant.
So, what are the different functions of the five branches of the military?
Army. The United States Army is the main ground-force of the United States. The Army's main function is to protect and defend the United States (and its interests) by way of ground troops, armor (tanks), artillery, attack helicopters, tactical nuclear weapons, etc. The Army is the oldest U.S. Military service, officially established by the Continental Congress on June 14, 1775. The Army is also the largest U.S. Military Service. There are approximately 76,000 officers and 401,000 enlisted members in the active duty Army. The Army is supported by two Reserve Forces which can be tapped for trained personnel and equipment during times of need: The Army Reserves, and the Army National Guard. The primary difference between the two is that the Reserves are "owned" and managed by the federal government, and each state "owns" it's own National Guard. However, the President of the United States or the Secretary of Defense can "activate" state National Guard members into Federal military service during times of need.