Shakespeare derived all his information for writing Julius Caesar from three short biographies by the Roman historian Plutarch, translated into English from a French translation of the original Latin. They were "The Life of Julius Caesar," "The Life of Brutus," and "The Life of Antony." Near the end of "The Life of Julius Caesar," Plutarch tells about how
There was a certain Cinna, however, one of the friends of Caesar, who chanced, as they say, to have seen during the previous night a strange vision. He dreamed, that is, that he was invited to supper by Caesar, and that when he excused himself, Caesar led him along by the hand, although he did not wish to go, but resisted.
Plutarch goes on to tell how this Cinna was mistaken by the rioting mob for one of the conspirators who was also named Cinna, and how
...the crowd rushed upon him and tore him in pieces among them. This more than anything else made Brutus and Cassius afraid, and not many days afterwards they withdrew from the city. What they did and suffered before they died, has been told in the Life of Brutus.
Shakespeare, who was also director and producer of the play, as well as one of the owners of the theater, had to employ many extras for this particular production because of the great importance of the scene in which Antony's marvelous funeral speech turns the commoners against the conspirators. No doubt, since he was paying all these extras, Shakespeare decided to make some further use of them, and not just have them sitting around backstage doing nothing except getting in everybody's way. So he not only included Act 3, Scene 3 to utilize these hired extras, but he also wrote an opening scene in which he could use them as well. No doubt he also used some or all of them as soldiers at the battle of Philippi.
In Act 1, Scene 1, Marullus and Flavius confront a crowd of men described as "certain Commoners" and drive them off the streets, berating them for their adulation of Julius Caesar. For example, Marullus says:
You blocks, you stones, you worse than senseless things!
O you hard hearts, you cruel men of Rome,
Knew you not Pompey?
Act 3, Scene 3 is not really necessary. Shakespeare is using it because he found it in Plutarch, because it seems interesting, because it gives a concrete illustration of the rioting induced by Antony's speech, and because it is a way for Shakespeare to get additional work out of a group of extras. Having a lot of men on the stage probably helps to create an impression of seeing the crowded ancient city of Rome, the capital of the known world.
Shakespeare often wrote scenes to create extra work for actors he had to pay anyway. For instance, the actor who plays Caesar appears again as his own ghost in Act 4, Scene 3. Shakespeare got this anecdote about Caesar's ghost from Plutarch too. And in Macbeth, the supporting actor who plays the important role of Banquo is killed off early in the play, but he is brought back as his own ghost at the coronation banquet and again when Macbeth consults the three witches in Act 4, Scene 1. The boy actor who plays Calpurnia in Julius Caesar probably also plays Portia, wearing a different-colored wig, and he may later play Brutus's servant Lucius later on.