He composed a lot of church music. By far the most famous of his compositions is the Miserere mei, Deus, often just referred to as "Allegri's 'Miserere'". There is a very famous story about this music.
Miserere mei, Deus is a motet written to be sung by two choirs, one in which the singers are divided into five groups (five voices) and the other in four groups. One choir sings a simple kind of tune called a fauxbourdon which is based on a plainchant. The other sings a more complicated version, with a top part which goes up to top C (the note two octaves higher than Middle C).
The piece is written in a traditional church style. Allegri had learned composition from a friend of Giovanni da Palestrina, the greatest church composer of the Renaissance. However, the style of Allegri's music is more modern than Palestrina. Allegri was writing in the early Baroque period.
Allegri wrote the Miserere to be sung in the Pope's Sistine Chapel. The Vatican did not want anyone else to perform the music, so no one was allowed to take the music away or make copies of it. However, when the 14-year-old Mozart visited the Vatican in 1770 with his father, he heard it twice, went home and wrote all the music out from memory. Mozart's copy of the music was sent to England where it was published by Dr Charles Burney. There were no copyright laws in those days, so there was nothing that the Vatican could do about it.