'Nope' is a variant of 'no' (exclamation). First known use: 1888 . Phonologically, pronunciation can explain where the P came from. Suppose someone asked you a question and you said 'No'. You'd usually pause after saying 'No' (exclamation) with your lips already positioned to articulate a P, that's why most people articulate a P. More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.