This question already has an answer here:
I have no idea how the magic gene in Harry Potter is supposed to work, or how it first came about. It could have been some kind of genetic mutation, or maybe we--I mean, wizards--are a totally different species. I have no idea. Anyway, my question is, how long has magic existed? In other words, when did the ability to do magic first manifest itself in humans? Like, when homo sapoens first appeared, or Neanderthals, or after that? Mybe it was well after the first civilization.