Magic follows both science and religion. It's difficult to say as to how we as people are capable of magic. Maybe history can tell us the origins of how different paths came to be. For example, the bible. Israelites would pray and call upon God in their time of need. Other nations worship the demon, Bael, the first fallen angel of the 72 spirits of Solomon. Jesus brought a man back from the dead, heal the sick, cast away demons and resurrected from the dead. Every religion discusses entities and their capabilities. This is the religious side of the explanation. Now, I shall reveal the sciences. Magic still follows the rules of physics. We as people use our energy to influence things to our will. Energy cannot be created nor destroyed. It can only be transferred. There is positive energy and negative energy. There was a story of the three bags if rice that explains the different results between positive, negative and no energy. When I feel weak or fatigued, I draw my energy from either the moon or nature. This is just my method as I tend to grow tired often.
There is evidence of belief in the paranormal since long before humankind ever recorded history in writing. In fact, there is speculation about whether our pre-human ancestors had religious or spiritual beliefs. Some cave paintings of pre-historic humans are believed to be predictive in nature, sort of a ritual to previsualize a successful hunt. In this sense, if the speculation is correct, then it is much like people currently use sigils.
In this sense, it could easily be argued that 'magic,' in its most basic sense: The use of will to enact change or influence an outcome, could be as old as human-like cognition itself.