"(What Did I Do to Be So) Black and Blue" was composed by Fats Waller and Harry Brooks with lyrics by Andy Razaf (learn more about him in a comment to this post). The song was originally written for the 1929 Broadway musical Hot Chocolates in which a dark-skinned black woman sings it as a lament after her lighter-skinned lover’s loss of interest in her.
Louis Armstrong would later perform a shortened version of the song with a key lyric change (from I’m white…inside to I’m right…inside) as a commentary on America's racist society. His performance of the song in East Berlin in 1965 was particularly powerful.
Here's a free link to a New York Times article about Armstrong and this particular performance.