The imperfetto (eg. facevo, era) is used for a continuous or repeated action or a description in the past. For example, if something happened everyday you would use the imperfetto, (eg. 'Ogni giorno mangiavo delle uova per colazione'). Usually if you would say 'used to' in English, this means the imperfetto is needed in Italian. You would also use the imperfetto for descriptions (eg. Il tempo era bello quando erevamo in vacanza.)
The passato prossimo (eg. ho fatto, è stato) is used for a completed action in the past, usually a one-off. For example, 'L'anno scorso sono andato a Roma' or 'Ieri ho mangiato troppi dolci!'