Castagna studied in universities all across Italy and obtained a doctorate in civil law and canon law when he finished his studies at the University of Bologna. Soon after he became auditor of his uncle, Cardinal Girolamo Verallo, whom he accompanied as datary on a papal legation to France. He served as a constitutional lawyer and entered the Roman Curia during the pontificate of Pope Julius III as the Referendary of the Apostolic Signatura. Castagna was chosen to be the new Archbishop of Rossano on 1 March 1553, and he would quickly receive all the minor and major orders culminating in his ordination to the priesthood on 30 March 1553 in Rome. He then received episcopal consecration a month after at the home of Cardinal Verallo.