Castiglioni was born and raised in Milan, where he began studying piano at the age of 7. He received his performer's diploma from the Milan Conservatory in 1952, and graduated there in composition in 1953. His student compositions were marked by Stravinsky's neo-classicism, but after graduation his style changed under the influence of the Second Viennese School. His interest in twelve-tone technique was joined with musical-political engagement, though this was short-lived. The Impromptus I-IV, identified by the composer as his first true opus, abandoned these expressionistic tensions, and these four short pieces exhibit a close relationship to Webern’s aphoristic style, while also moving closer to the European avant garde. Personal contact with Luciano Berio at the RAI electronic music studio in Milan also influenced Castiglioni's direction at that time, and his attendance at the Darmstädter Ferienkurse completed this development (Geraci 2001).
Following his return to Italy in 1970, he eventually resumed teaching composition at the conservatories of Trent (1976–77), Milan (1977–89), Como (1989–91) and Milan once again (1991–6). Among his many students are Armando Franceschini, Giampaolo Testoni and Carlo Galante, Alfio Fazio, Aldo Brizzi, Matteo Silva and Esa-Pekka Salonen.