The question can be as long and as broad as the history of literature going back to the epic of Gilgamesh and the bible. In terms of a diametric 'good vs evil' conflict the literary tradition stretches back to the ancient religions of India, the near east and China. You find the nature of 'sin', and an 'evil' force who corrupts humans intrinsically tied up in texts such as the Bible, Bagdavita, and the Zororastrian holy text the Avesta. Most religious philosophies of the bronze and iron ages saw the moral landscape through this duality, with outlying philosophies such as Buddhism and Confucianism taking a different approach to the idea of morality and suffering.
When you look at Greek literature, especially their concept of gods who had human emotions and delights you see a panalopy of gods and kings who try to take over the world, which in turn entered the literary canon through Greek plays and epics, such as the Iliad. These tales wrapped up morality tales with fragments of oral history that was passed down from the bronze age early Greek civilisation to the later iron age Greek authors (such as the invasions of what would come to be called Troy and Colchis). This tradition of wrapping fragmented history into epics is found throughout the eastern Mediterranean in Egypt, Minoa, Carthage, Judea, and eventually crystallising in the stories passed down from the Romans. The Christian bible can be seen a fulmination of this idea of a super-villain, Lucifer, attempting to take over the world, and the hero, Jesus/God, saving humanity through their sacrifice and resurrection.
Now, in terms of the 'modern' idea of villainy, Shakespeare and his Renaissance contemporaries are a good starting point for the reinvention of the moral vs evil into both state propaganda and popularist entertainment. Plays such as Richard III and Macbeth were written at the behest of the monarchs Shakespeare served, casting two historic monarchs are paragons of decay and villainy. This was especially pronounced with Richard III, who the tutors especially wanted to be portrayed as a twisted and villainous king who was justly overthrown by Henry Tudor. Macbeth had a similar fate, as James VI's Stuart dynasty had risen to power on the back of the fall of the historical Macbeth's dynasty.
As British literature flourished in the 18th century the French came under heavy literary lampooning, with golden age of satire writers such as George Cruikshank helping both to send up Napoleon as a caricature of villainy and also as the overarching 'Villain' threatening all of Europe. I would posit that Napoleon probably bests fits the first modern idea of a super villain who could directly destroy the moral fabric of the world. This notion of 'villain', with its mass market pamphlets that reached an ever growing and literate audience across Europe and the USA, was the first example of how the industrialisation of printing, as opposed to the most bespoke and country specific pamphlets that were produced by hand printing during the Enlightenment. Indeed, I would go as far as to say that the reason why the Napoleonic project both succeeded in the short term, and failed in the long term, was because the British in particular had a 'free' press that was able to caricature and demonise Napoleon to a larger extent than had been possible in previous eras, touching a larger portion of the newly literate population, and thus ensuring that the 'liberal' ideals of the French revolution did not spark a mass anti-monarchy revolution in Britain in the period 1792-1815.
Throughout the 19th Century satirists, propagandists, and state controlled media utilised the idea of villainy and demagoguery to control their populations, with Metternich and Bismark being statesmen who both used the notion of political bogeymen (liberals for the reactionary Metternich and Catholics/socialists for Bismark). The British and Russians sparred with the notion of villainy during the Great Game, and after the catastrophe of 1871 French revanchanism was stoked by the villainy of the stereotypical German soldier. In turn, during World War I Kaiser Wilhelm II was portrayed as a master villain by the British and French, controlling the machinations of his murderous Bosch.
TL:DR: So, in answer to your question, I would argue that the history of human literature has the notion of the super villain embedded from the very start, such as devil in the Bible. The idea of the modern super-villain in English probably arose around the time of Shakespeare's Richard III and the propaganda needs of Tudor court. In turn, as industrial printing took hold during the Industrial Revolution the British were able to demonise Napoleon and the French Revolutionary ideals to such a degree that Napoleon could rightly been seen as the first historic figure in his own lifetime who was cast as a villain to such a degree by his enemies that his reputation and political objectives were stymied to a greater degree by that propaganda.
Sources:
'Napoleon the Great' by Andrew Roberts
'A History of Zoroastrianism Vol I' by Mary Boyce
'Richard the Third' by William Shakespeare
'The Pursuit of Power: History of Europe 1815-1914' Richard J Evans