There are two ways to do these kinds of scenes, depending on the budget. If there is a lot of money to produce the movie, the studio might build a piece of the street to shoot their movie. In this case, the set is a closed location and no one from outside is allowed on the set, so no one would panic and call the police.
The second way is to shoot this on some real street. How would one do this depends on the country in which the movie is shot. Probably in most countries you need to provide some forms, pay the fee, agree on the date and so on. After that, the street is blocked by the police and bystanders are not allowed on the closed streets and can clearly see, that the accident happening is guarded by the police and surrounded by a lot of cameras and staff.
An example of such a scene can be seen here. You can see, that all the people present there is the staff of production.