The Congress decided on June 3, 1795 that the United States Flag will "be never changed from the original flag of thirteen stripes and thirteen stars." The reason for this is the immense amount of stars that would eventually have to be added to the flag.
Between 1828 to 1863 the official variant of the United States had been the Betsy Ross variant by order of the US Congress. Before this there was no official way that the flag's stars were arranged or the size of the canton was regulated.
After the adoption of the Postbellum Constitution the United States Congress changed the stars of the flag to represent the number of states that existed when the new Constitution was established. It has not changed since though it has several variants.
The branches of the US Military have their own specific flags to use at general headquarters and other federal places that aren't owned by any particular regiment. The Branch Colours are also used by high ranking officers who are not affiliated with a single regiment (Like a General, Admiral, etc.)
The American military, especially the Army, often have a strong attachment to their regiment and often create a unique regimental colours that they carry into battle alongside the sanctioned US Flag. Although not required, nearly all US Armies have a regimental colour. State Armies, though still part of the US Army, are often thought of as distinctly different from Federal Armies as they often retain great loyalties to their states.
State Armies recruit only from the state in question and never from outside the state. Transfers between State Armies do not occur - although transfers from State Armies to Federal Armies happen quite often to things like the Army Engineering Corps, Army Scouts, Army Cavalry, etc.
The Federal Army, not having any connection to states, often also has a strong connection to their regimental colours although not nearly as much so as the State Armies. Federal units have strongest connections to the federal government.
Federal Armies recruit from the Army itself. The Marine Corps, Navy, Coast Guard, and Public Health Service are all Federally oriented, with no equivalent of State Armies.