It was there in the original versions of D&D. It also exists in Rogue, etc.
Like many things in D&D, it’s has pretty weird, sloppy, gamey mechanics, in my opinion. Levels in D&D are gained with experience points, which often come from weird things other than experience, such as how much gold you take. Thinking literally about many (most?) things in D&D tends to lead to silliness and contradictions, it seems to me, which is why I always preferred more logical games.
Experience is one of the prized accomplishments of players, and losing levels means losing a lot of play rewards, so it makes vampires particularly “scary” for players, especially players who get upset when their characters lose things (and many D&D players, particularly in later generations, really hate to lose things…). In comparison to conventional weapon attacks in D&D, losing levels not something that can be easily and quickly restored, while physical damage generally is very recoverable with little or no consequence, so that also adds to the fear and loathing.
I don’t know that there is a good consistent explanation of what the level draining is supposed to represent in D&D, as levels are an artificial game mechanic and not a real-world thing, per se. Some people and different versions may have more or less, and different opinions. See for example this post wondering the same sorts of things: http://grognardia.blogspot.com/2010/05/energy-drain.html which invites and receives opinions from others in comments.
Real-world vampire lore also varies quite a bit from version to version. However it is pretty common that the sucking of blood leads to a condition or disease often called vampirism, which includes lack of energy and willpower (particularly against vampiric suggestions) and often conversion into a minor vampire oneself. So it would be reasonable to think that in D&D it involves blood sucking and the effects of both blood loss and the disease and/or vampiric magic, though depending on how you imagine D&D’s abstract combat, it might be a magic ability that doesn’t need to literally mean sucking blood through a bite.
In pop psychology, there is the term “emotional vampire” which does describe people who such the life from others, generally by means of asocial passive behaviors.