Questions & Answers about Když je v bytě ticho, moje babička spí dobře.
Když means when here. It introduces a subordinate clause: Když je v bytě ticho = When it is quiet in the apartment.
A Czech learner should notice that this first part sets the situation, and the main clause comes after it: moje babička spí dobře.
So the structure is:
Když... , ...
very much like English:
When... , ...
The comma separates the subordinate clause from the main clause.
In Czech, commas are used very regularly before or after subordinate clauses. Since the sentence starts with the Když clause, the comma comes before the main clause.