Can you see the difference in meaning in these two sentences?
When the guests arrived, Jane was cooking dinner.
When the guests arrived, Jane cooked dinner.
In the first one, Jane started cooking dinner before the guests arrived. We know that because it uses the past continuous. In the second sentence, the guests arrived first and then Jane started cooking.