As a youth Mayr entered the University of Ingolstadt to study theology, but while there he learned to play several instruments.
Mayr wrote a commemorative biography of Joseph Haydn, many works on music theory, and an autobiography that was edited and published posthumously, and he founded two institutions for poor and elderly musicians. Of his more than 60 operas, the best-remembered include La Lodoiska (1796), Ginevra di Scozia (1801), Medea in Corinto (1813), and La rosa bianca e la rosa rossa (1813; "The White Rose and the Red Rose").