Shakespeare's historical source of the play Macbeth was Raphael Holinshed's Chronicles of England Scotland, and Ireland which was written in 1587. The book refers to Banquo as an acquaintance of Macbeth's. According to the history, Macbeth, with the help of others, conspired with Banquo to kill the weak and ineffectual King Duncan.
Now, as Macbeth was dedicated to King James and Duncan and Banquo were, as legend had it, both in the royal line of King James, Shakespeare changed the history and made the men sympathetic characters.
Because it was not uncommon for aristocratic families to claim descent from mythological characters, the Stewart clan (from which King James I of England came) claimed descent from Banquo, known as the Thane of Loch Aber (Scottish Gaelic spelling). This Thane of Loch Aber was a Highland chief of legend from the time of the Scottish king Macbeth, although Banquo's son Fleance was a very real character.
As has previously been mentioned, Shakespeare modified in several ways his tragedy entitled Macbeth for political reasons. Within weeks after James VI of Scotland became James I of England in 1603, Shakespeare's acting company was given the title of "The King's Men." Naturally, these actors were expected to perform at many royal events in return for this honor. Therefore, it clearly behooved Shakespeare to remain in the favor of the king and alter history to suit the royal tastes.
Neither Banquo nor Fleance really existed. There was a legend, however, that James I, king at the time Shakespeare wrote and performed Macbeth, was descended from the line of Banquo. Some people say Banquo is included in the play to mock King James, although a more common suggestion is that he is included to flatter the king. There was a lot of politics around the legality of theatre in the time of James I, so it might well have paid for Shakespeare to keep on the good side of the king.