The play telescopes most of Edward II's reign into a single narrative, beginning with the recall of his favourite, Piers Gaveston, from exile, and ending with his son, Edward III, executing Mortimer Junior for the king's murder.
Marlowe's play opens at the outset of the reign, with Edward's exiled favourite, Piers Gaveston, rejoicing at the recent death of Edward I and his own resulting ability to return to England. In the following passage he plans the entertainments with which he will delight the king:
Music and poetry is his delight;
Therefore I'll have Italian masques by night,
Sweet speeches, comedies, and pleasing shows;
And in the day, when he shall walk abroad,
Like sylvan nymphs my pages shall be clad;
My men, like satyrs grazing on the lawns,
Shall with their goat-feet dance an antic hay.
Sometime a lovely boy in Dian's shape,
With hair that gilds the water as it glides,
Crownets of pearl about his naked arms,
And in his sportful hands an olive tree
To hide those parts which men delight to see,
Shall bathe him in a spring; and there, hard by,
One like Actaeon, peeping through the grove,
Shall by the angry goddess be transformed,
And running in the likeness of a hart
By yelping hounds pulled down and seem to die.
Such things as these best please his majesty. (I.i.53–70)
Upon Gaveston’s re-entry into the country, Edward gives him titles, access to the royal treasury, and the option of having guards protect him. Although Gaveston himself is not of noble birth, he maintains that he is better than common people and craves pleasing shows, Italian masques, music and poetry. However, as much as Gaveston pleases the king he finds scant favour from the king's nobles, who are soon clamouring for Gaveston's exile. Edward is forced to agree to this and banishes Gaveston to Ireland, but Isabella of France, the Queen, who still hopes for his favour, persuades Mortimer, who later becomes her lover, to argue for his recall, though only so that he may be more conveniently murdered. The nobles accordingly soon find an excuse to turn on Gaveston again, and eventually capture and execute him. Edward in turn executes two of the nobles who persecuted Gaveston, Warwick and Lancaster.
Edward now seeks comfort in a new favourite, Spencer, and his father, decisively alienating Isabella, who takes Mortimer as her lover and travels to France with her son in search of allies. France, however, will not help the queen and refuses to give her arms, although she does get help from Sir John of Hainault. Edward, both in the play and in history, is nothing like the soldier his father was – it was during his reign that the English army was disastrously defeated at Bannockburn – and is soon outgeneralled. Edward takes refuge in Neath Abbey, but is betrayed by a mower, who emblematically carries a scythe. Both Spencers are executed, and the king himself is taken first to Kenilworth. His brother Edmund, Earl of Kent, after having initially renounced his cause, now tries to help him but realizes too late the power the young Mortimer now has. Arrested for approaching the imprisoned Edward, Edmund is taken to court, where Mortimer, Isabella, and Edward III preside. He is executed by Mortimer, who claims he is a threat to the throne, despite the pleading of Edward III.
The prisoner king is then taken to Berkeley Castle, where he meets the luxuriously cruel Lightborn, whose name is an anglicised version of "Lucifer". Despite knowing that Lightborn is there to kill him, Edward asks him to stay by his side. Lightborn, realizing that the king will not fall for deception, kills him. Maltravers and Gurney witness this before Gurney kills Lightborn to keep his silence. Later, however, Gurney flees, and Mortimer sends Maltravers after him, as they fear betrayal. Isabella arrives to warn Mortimer that Edward III, her son with Edward II, has discovered their plot. Before they can plan accordingly, her son arrives with attendants and other lords, accusing Mortimer of murder. Mortimer denies this, but eventually is arrested and taken away. He tells Isabella not to weep for him, and the queen begs her son to show Mortimer mercy, but he refuses. Edward III then orders Mortimer's death and his mother's imprisonment, and the play ends with him taking the throne.

Question: Why does Edward execute the two nobles?
Answer: The nobles persecuted Gaveston, Warwick, and Lancaster.