In the final scene, chaos ensues as the identical appearing Cesario (Viola) and Sebastian are each blamed for the other's actions. First Feste blames Sebastian for beckoning him, not realizing it was Cesario who called for him.
Cesario spots Antonio the man who saved him from fighting Sir Andrew but was taken prisoner by Orsino's officers in Act III. Antonio again asks Cesario for his wallet back thinking he is Sebastian. Cesario (Viola), who does not know Antonio, does not and so Antonio curses him for his betrayal, not realizing he is talking to Cesario not Sebastian whom he lent his wallet to.
We learn that Antonio is an enemy of Illyria and especially of Orsino for plundering his ships as a pirate in the past.
Now a prisoner, Antonio baffles Orsino by telling him that he and Cesario (Viola) have been together night and day for three weeks when who Antonio is really thinking of is Sebastian. Orsino cannot believe this; Cesario has been with him for three weeks.