Traditionally, the producer is the artist who makes the beat (the instrumental) of a song.
The MC is the person who raps over that beat.
Wikipedia has it written as:
"Hip hop as a general rule consists of two elements: an instrumental track (the "beat") and a vocal track (the "rap"). The artist who crafts the beat is the producer (or beatmaker), and the ...