You can already request it from the Embassy before you leave for Italy or wait until you have arrived in Italy and contact a local office of the Revenue Agency (Agenzie delle Entrate).
The tax code is needed to carry out various activities, for example: opening a bank account, entering into a rental contract, receiving payments from the University of Bologna.