What were Shakespeare's sources for the play Macbeth and how did he change them?
Shakespeare liked to use history to get ideas, but his plays are actually quite a distance from history. I actually read the other day that they found a relative of Richard III. He wasn’t the greatest guy, but Shakespeare certainly demonized him.
Macbeth was written especially for James I and was performed in 1606. James I was King of Scotland when he came to the English throne; his descendants can be traced back to Banquo. (enotes historical background, see first link)
The witches, floating daggers and ghosts would perhaps be an indication that this story is fanciful and not based on much historical reality.
Mac Bethad mac Findláich, known in English as Macbeth, was born in around 1005. …In August 1040, he killed the ruling king, Duncan I, in battle near Elgin, Morayshire. (BBC, see second link)
Shakespeare thus took real events, to please a real person—James I—and made them a bit more fanciful. Why he thought James I would like a play where his ancestor died, I do not know.