The passato prossimo is used to express an action which began and was completed at a definite time in the past. The action may have lasted a long time or a short time, and it may have taken place more than once, but this action has terminated in the present. The passato prossimo answers the question: What happened?
L’altro giorno ho visto Matteo. I saw Matteo the other day.
Valentina ha ballato fino a mezzanotte. Valentina danced until midnight.
Ho dimenticato l'ombrello sull'autobus. I left my umbrella on the bus.
The imperfetto is used to describe how people or things were in the past. It is also used to describe past actions that were habitual. The imperfetto expresses past actions that were repeated over a period of time, with no reference to their completion. The imperfetto also describes conditions and states of being (physical, emotional, mental) in the past. The imperfetto answers the questions: What was it like? What was happening?