Any evil deity with the Arcana domain. Vecna would be a good one. The gift of magic needn't even be intentional, it could be a byproduct of a ritual cast centuries ago by a theurge. Alternatively, one of the faithful of said god created you as an experiment. Think of the babies from Paranormal Activity who were bred in order to mix their bloodlines together and create a host body for the demon.