Answer:
Both sides used Numbers to identify their regiments and the State from where they originated. Thus their name is referred to by "16th North Carolina Regiment" and "7th Massachusetts Regiment". The Union had some regiments that were regular infantry and had an identity such as "1st United States Infantry".
When the war stared, the Southerners began to join to fight the war and they enlisted in local militia. These were usually organized into companies(~200 men) and were give names that expressed their locality or their willing to fight. Some examples are:
Dixie Heroes
Yazoo Greys
Black Hawk Rifles
Neill's Guards
Buckner Rebels
These small units were grouped together for further training and organization into large forces. That is where the Regiments were formed from 10 to 12 of these companies.
The Regiments were named for their state and numbered. Some regiments, especially in the Union, had a long name that included terms like "State Volunteers" and such but in most documents they were referred to by the Number and State.
This did cause some confusion with similar names. A unit named a Ranger Battalion was confused with one named as a Regiment. This resulted in some duplication. Both Mississippi and Alabama had a pair of cavalry regiments with the same name.
Hope this answers your question.