By contemporary racism, in this case I mean racism based on skin colour and other physical differences, and as I've understood it, racism used to be more related to nationalities than anything else. Did this rise from the USA's slave trade and its attempts to justify it, or did it arise from other factors or places?
I don't know if I'd use the word manufactured; it isn't quite that straight-forward. Rather, racial prejudice as it evolves in America emerges gradually and awkwardly from the 16th Century onwards in European discourse and has been well established by the time the United States came into being as a nation in the last quarter of the 18th Century. Fundamentally, this is the result of European experiences with the exploration of Africa and engagement in the transatlantic slave trade.
From the perspective of the history of what would become the United States, racism really has its origins in cultural and religious differences between white Europeans and black Africans. Europeans were of course aware of differences in skin colour between white and black people, but this was not initially the most salient difference in their minds. Rather, they were much more concerned about what they perceived to be primitive and degenerate religious practices, a sexual culture that they saw as immoral and degraded, and a lifestyle they saw as uncivilised. Though at least for the English the colour of African skin had an immediate and profound impact (particularly because black was already seen as a 'dirty' colour in English culture), it was not the most apparent difference in mind.
Rather, racism proper begins to develop as these perceived defects slowly but surely become more and more associated with darkness of skin, and as Europeans try to find ways to rationalise and explain the differences between them and the other peoples of the world. In particular, the experience of the slave trade profoundly warps and twists the development of the notion of inherent racial difference. Initially, enslavement is largely based on the fact that its victims are not Christians; as time goes on and as involvement in the slave trade and slavery increases, senses that these fundamental differences between Europeans and Africans are in some way racial and reflected in skin colour gain traction.
This works as something of a brutal cycle. European encounters with Africa create the impression in their minds of a degraded and uncivilised people, which eases qualms about the slave trade; the slave trade further degrades and dehumanises Africans in the European mindset, encouraging more prejudice. Likewise, as the trade picks up steam, so too are more complex rationalisations and justifications needed for the hierarchy it is creating - just as explanations for the obvious differences between Human beings are needed by a Europe increasingly interested in understanding the wider world. By the mid-17th Century, we can speak broadly of a distinct racial philosophy in British colonies; in 1667, Britain's colony in Virginia passes its first piece of legislation that truly recognises the beginnings of a legally racially-based system of slavery, when it decrees that the children of black women inherit the condition of their mother (i.e., a slave woman's children are born slaves). In essence, as time goes on, the ideas implicit in the words "black" and "slave" collapse together until they become essentially inseparable; to be black was to be, culturally speaking, a slave; a lesser person. By the 18th century, this ideology is well and truly entrenched.
In part, this collapsing of identity is manufactured in the sense that, as racial slavery becomes more common and rises to become the primary source of forced labour in the colonies, so too do white encounters with black people and so too does the need to rationalise, explain and justify this system of labour. There is certainly a substantial element of trying to rationalise a heinous system of exploitation after the fact, but this is also an organic process made possible by pre-existing cultural and religious prejudice that was immediate from the earliest European encounters with Africa and its people.
So the United States is not the creator of racism per se, though early Americans are certainly intimately involved in its development; by the time of its independence, racial ideology is well entrenched in law and culture. The US does prove to be a superb breeding ground for complex racist ideology and ideas by the 19th Century, as southern slaveholding society constructs a uniquely and insidiously pro-slavery ideology, but racism itself has origins that long predate the United States. In a manner of speaking, one can say that the United States was much more a product of racism, in the sense that the story of racism's development is crucial to understanding one of the institutions (slavery) that came to so dominate its national history. Racism both shores up the slave trade and emerges as a justification for it.
Many of the stereotypes and beliefs expressed by those with anti-African American prejudices today can be traced back to rationalisations and justifications for slavery that emerged in the late 18th and especially the 19th centuries; some can be taken even further back than that. For instance, you can trace fantastical ideas about black men being a threat to white women right back to those early English ideas of 'black' being dirty and sullying the 'purity' of whiteness, coupled with a disturbed fascination on the part of some early white Europeans with the perceived (and in their mind, fascinating yet disturbing) strong sexuality of African men and women. Likewise, ideas about 'black laziness' essentially have their origins in arguments used by slaveholders in the 18th and 19th centuries to defend slavery on the grounds that, if they abolished it, the ex-slaves would never do any work even if you paid them. Modern-day racism absolutely has its legacy in slavery.
By way of reading recommendations, there are many good books on this topic, and many more that deal with it in some substantial way. For me, the definitive text remains Winthrop Jordan's 1968 White Over Black: American Attitudes toward the Negro, 1550 - 1812 (which was reissued in 1974 as the abridged The White Man's Burden: Historical Origins of Racism in the United States, which is more friendly to a causal reader). For a perspective from the other side of the racial divide, Mia Bay's The White Image in the Black Mind: African-American Ideas about White People, 1830 - 1925 (2000) is always well worth a read.
Do you actually mean the USA, or rather those involved in the North American slave trade generally? Since the North American slave trade predates the American revolution.