Before the Civil Rights Movement that began in the 60's, blacks were usually Republican.
Which party objected to Civil Rights (and still does)?
The basic history is that The Democratic Party was largely the South around the time of the civil war, and the new Republican party was largely the 'north'.
The Republicans' first president, Lincoln, 'freed the slaves', and blacks' loyalty was set for decades to come.
The whole nation was basically racist this whole time. Not as much as the south, but quite racist, and the parties were not far apart on it.
Up through the 50's, both parties had a claim to the black vote. The Democrats' northern faction had some more pro-black activities - appointing black judges, integrating the military - but it also had the boweevils, the racist Southern Democrats who filibustered civil rights bills. This was the case headed into the JFK-Nixon elections.
Starting then, JFK called Martin Luther King's wife while he was in jail, symbolically showing support for the blacks - but quite cautiously. While president, he changed a lot on the issue and became with his brother a leader for civil rights. He was the first president to tell the nation it was a moral issue. This was where Democrats sided with blacks; in the 60's, this also led to the black riots. Republicans chose to use the issue for themselves by siding with whites and racists against blacks.
This was called the 'Southern Strategy' in the Nixon campaign. LBJ had said when he signed the civil rights bill that he'd handed the White House to Republicans for many years to come; Republicans made sure of it. This was 'dog whistle' politics, and the end of the 'Solid South', which further became and largely stayed Republican with Reagan (who began his campaign with a states' rights (code for anti-civil rights)speech in Mississippi where civil rights had been killed.
This is the modern history; since Reagan, Republicans have been the party of the rich, while Democrats had launched the war on poverty and helped the poor.