Rap became a recorded thing in the early '80s. There are 3 potential "first recorded rap songs," I prefer the belief that Sugarhill Gang's Rapper's Delight is the 'true first.' So, rap is probably older than maybe you think. (It's certainly older than I thought at first.)
I wasn't around when it came out, so I can't give you a first hand impression, but my understanding is that rap existed as a form of expression especially in urban (city) communities long before it was recorded - i.e., that while Rapper's Delight was at least among the first, if not the first, rap song recorded and released for popular consumption, the idea of rap and rapping was not new to listeners when the single was released in 1979.
Hip-hop, a more broad category of music which I believe can be taken to include "rap" as a subgenre, I believe descended/is most closely related to R&B (rhythm and blues), which in turn is a descendent of the jazz of the 1920s and 1930s.
I bet that you and I would both love to hear, maybe, determinedkid weigh in on this, as I'm pretty sure he knows way more about ran and hip-hop and its evolution than I do, although he wasn't there in 1979 either. nowaypablo may have something valid to throw in too, not sure ;)
Shoutout: if you haven't, consider checking out the tag #hiphophubski .
Side note, my brother has Rapper's Delight on LP, and it's one of the records I'm most jealous of him for possessing.