Prisoner of war camps on both sides during the American Civil War were miserable, deadly places to be. While Andersonville is the most infamous of such prisons, we should first note that conditions there were not unique for the time period.
Early in 1862, Abraham Lincoln chose a strategy which would take advantage of the population edge the North (22 million) had over the South (5 million), which was to end the prisoner exchanges that typically occurred during wartime. By 1864, southern POW camps were bursting at the seams, and construction of a new camp at Andersonville became necessary. Once it opened, it was instantly packed. At 33,000 prisoners, and had it been an actual city, it would have been the fifth largest in the Confederacy. So one of the factors for the horrible conditions and death rate was how badly overcrowded it was.
Another factor was the hatred and enmity of southerners towards Yankee prisoners. The war had created intense and bitter feelings between the two sides, and unfortunately this was often visited on the soldiers captured in battle. As Sherman's army burned their way across Georgia, Confederates had little pity towards their captives. The same was true in reverse up North.
A third factor was the blockade the North had imposed on the South, which meant food and medical supplies were in critically short supply by 1864. That which the South did have was destined first for the Army, second for the civilian population, and last for the prisoners they held.
Lastly, Henry Wirz was the commandant of the camp, and he as well as his superior, General John H. Winder, had no love for those they had imprisoned.
All of these factors contributed to the deaths of 13,000 Union soldiers at Andersonville.