The passé composé and the imparfait both describe the past, but they answer different questions: the passé composé tells what happened — a specific, completed event — while the imparfait describes what was happening, ongoing states, habits, or background scenery. Je regardais la télé quand le téléphone a sonné (I was watching TV when the phone rang) uses both in a single sentence, one for each role.
A useful test is whether the action has a clear beginning and end that matters to the story: hier, j'ai visité le musée (yesterday, I visited the museum — a completed event) versus quand j'étais petit, je visitais souvent ce musée (when I was little, I often used to visit that museum — a repeated habit, no specific endpoint).