The majority of deaths occurred as a result of disease and infection, rather than combat. Poor sanitation and medical care led to widespread outbreaks of diseases such as typhoid, dysentery, and smallpox, which claimed the lives of thousands of soldiers on both sides.
In terms of combat-related deaths, the Union Army suffered more casualties than the Confederate Army. This is attributed to several factors, including the Union Army's larger size, the fact that it fought more battles, and its superior resources. The Union Army is estimated to have lost around 360,000 soldiers in combat, while the Confederate Army lost approximately 258,000.
It's important to note that these numbers are estimates, and there may be some variation in different sources. The exact number of casualties may never be known with certainty.