They do a number of things. When someone commits a crime (= breaks the law and does something wrong / illegal / against the law) the police must investigate (= try to find out what happened / who is responsible). If they find the person responsible for the crime, they arrest them (= take them to the police station). At the police station, they question them ( = ask them questions to find out what they know) and if they are sure the person committed the crime, the person is charged with the crime (= the police make an official statement that they believe the person committed the crime). The person must then go to court for trial.
In court, the person charged with the crime (now called the defendant or accused) must try to prove (= provide facts to show something is true) that they did not commit the crime; in other words prove that they are innocent (* guilty). The jury listens to all the evidence (= information about the crime, for and against the defendant) and then makes their decision.
If the defendant is convicted of the crime (= the jury decides that the defendant is guilty), the judge will give the sentence (= the punishment). For example, if a person is convicted of murder, the sentence will be many years in prison. The person then becomes a prisoner, and the room they live in is called a cell.
For crimes that are not serious (often called minor offences, e.g. illegal parking), the punishment is usually a fine (= money you have to pay).