"Scalawags" were Southerners who were sympathetic, or perceived as sympathetic, to Reconstruction, which not only involved repairing and repatriating the South after the Civil War but also involved making black people full citizens. This included giving them places in government and ownership of property (e.g., forty acres and a mule).
The origins of the term are unclear, though it developed in the 1840s, probably in response to the Whig party, which was sympathetic to the abolitionist cause. It is also important to note that the Republican party of that time developed out of the dissolved Whig Party. "Scalawag" describes a person or an animal considered to be worthless. Some scalawags were from the planter aristocracy, while others were Union soldiers from states like Kentucky or West Virginia. They were deemed "worthless" due to their unwillingness to support Southern values and heritage. Slavery and the eventual oppression of black citizens was integral to white Southern society, in addition to support of the rebel cause.
"Carpetbaggers" were Northerners who went South to profit off of its destitution after the war. As with the "scalawags," it is not clear, and also highly unlikely, that every Northerner or financier, usually from the North, went South in order to profit off of the region's misery. Indeed, there were some who were involved in financial schemes, but there were others who were interested in repairing the South and integrating black citizens.
Both terms illustrate Southern hostility toward the Reconstruction effort.