The color regulation was a state subject.. New York and most of the other states in 1861 used grey as the uniform color for their uniform.
The blue was an official federal army color for regular troops since 1776.
In the first year of war, nearly every state used their own troops, commanded their own troops by state commanders and there was no real commander of an overall union or confederate army. So at First Manassas, New York, Wisconsin and Maine regiments marched with their very cool grey uniforms and crushed against southern troops of Virginia or Louisiana in their fancy blue dresses. Since most of the regular enlisted regiments served in the southern states, there was a high amount of blue in the southern army at Manassas.
After the battle, the uniform regulation for both armies got stronger and they choosed their main color... which resulted in blue for the US and grey for most of the CS troops