Passé composé: what happened
The passé composé is for things that happened - single, finished events that move a story forward. J'ai mangé, elle est partie, nous avons décidé. If you could put it on a timeline as a point, it takes the passé composé.
Imparfait: how things were
The imparfait is for how things were - background, habits, weather, age, feelings, and anything that was going on when something else interrupted it. Il faisait froid, je travaillais, elle avait vingt ans. It is the scenery, not the action.
Both in one sentence
Most real sentences use both, and that is the clearest way to feel the difference. Je dormais quand le téléphone a sonné - I was sleeping, the phone rang. The imparfait sets the scene, the passé composé breaks it. Swap them and the sentence stops making sense.
The être trap
One warning worth having early: the passé composé is built with avoir for most verbs but être for a small group of movement verbs and all reflexives, and with être the participle agrees with the subject - elle est allée, not elle est allé. That agreement is the mistake that survives longest.
Signal words, and their limits
Certain words lean strongly one way, and they make a useful first check. Habit words - d'habitude, souvent, tous les jours, chaque été, autrefois - usually call for the imparfait: tous les étés, nous allions à la mer. Words that mark a moment - soudain, tout à coup, un jour, hier soir, ce matin-là - usually call for the passé composé: tout à coup, la lumière s'est éteinte. But treat them as hints, not rules. A finished, bounded stretch of time takes the passé composé even when it was long: j'ai habité à Lyon pendant dix ans says those ten years are over and closed. The question is always whether you are presenting the event as a completed block or as the backdrop to something else.
Verbs that change meaning
A handful of common verbs say something genuinely different depending on the tense, and this is where the choice matters most. Je savais means I knew; j'ai su means I found out. Je connaissais Paul means I knew Paul; j'ai connu Paul means I met him. Je pouvais means I was able to, with no word on whether I did; j'ai pu means I managed it. Je voulais means I wanted to; j'ai voulu usually means I tried, or decided to. Even avoir shifts: j'avais peur describes a state of fear, while j'ai eu peur means something frightened me at a particular moment. Learn these as pairs and the general rule starts to feel obvious.
The tense you will read but rarely say
Open a French novel and you will meet a third past tense: the passé simple - il fut, elle alla, ils prirent. It does the job of the passé composé in formal written narrative, and in speech it has all but disappeared, so you need to recognise it rather than produce it. The imparfait does not change: in a novel it still paints the scenery while the passé simple moves the plot. For practice, tell yourself what happened yesterday in two passes. First list the events in the passé composé, then go back and add the weather, your mood and what was going on around you in the imparfait. Doing that out loud for a few minutes a day trains the choice far faster than fill-in-the-gap exercises.