Con Air, an action movie released in 1997 starring Nicholas Cage, features his character cutting a deal after killing a man during a fight after being assaulted. The judge rejects this deal and sentences the character to prison for 5 years. Is that how it works? Can judges reject deals and sentence people if their guilty pleas were given on the expectation of getting more lenient treatment? This was in the federal system if that matters.
According to the Federal Rules of Criminal Procedure, Rule 11 (c)(1), there are two different ways that such a plea deal could be negotiated:
Paragraph B: the prosecution agrees to recommend a particular sentence or range. Such a recommendation is not binding on the court, but would probably be followed in most cases.
Paragraph C: the prosecution agrees that a particular sentence or range is the appropriate disposition of the case. If the court accepts this type of plea deal, they have to impose the agreed sentence. The court does have the power to reject the agreement altogether, but in that case the defendant can withdraw their guilty plea and proceed to trial (or go back to the bargaining table with the prosecution).
So it depends on which type of deal was in place. For (B), the movie's course of events would be possible. For C, it would not.