Family background and education
Born in Louiseville, Gagnon was from a prominent family of musicians in Québec City. He is the younger brother of composer Ernest Gagnon and the father of composer Henri Gagnon. His sister Élisabeth was married to pianist Paul Letondal with whom he studied the piano in Montreal from 1960 to 1964. In 1870 he studied in Paris with Charles-Alexis Chauvet (organ), Antoine François Marmontel (piano), and Marie-Auguste Durand (harmony), and under Félix-Etienne Ledent (piano) and Jean-Théodore Radoux (harmony) in Liège. He pursued further studies in Dresden and Leipzig during the summers of 1871 and 1872 with Benjamin Robert Papperitz (organ) and Louis Plaidy (piano).
From 1864 to 1876, Gagnon was the organist of Saint-Jean-Baptiste Church in Quebec City, having succeeded his brother in that position. He once again replaced his brother in 1876, taking over the role of organist at the Notre-Dame Basilica-Cathedral in Quebec City where he remained through 1915. He was a founding member of the choral society Union musicale de Québec (1866) and of the Académie de musique du Québec (1868), a non-profit musical association and educational institution. He notably served several terms as president of the latter institution between 1878 and 1902.
From 1877 to 1917 Gagnon taught at both the École normale Laval and the Petit Séminaire de Québec in addition to maintaining a private studio. He also played a role in establishing the Dominion College of Music in 1894. He became the first director of the music conservatory at Université Laval in 1922, and taught at that school until his death in Quebec City in 1930. His pupils included Joseph-Arthur Bernier, Joseph-Daniel Dussault, Léo-Pol Morin, and his son Henri.