Stenhammar was born in Stockholm and was the brother of architect Ernst Stenhammar. He received his first musical education in Stockholm. He then went to Berlin to further his studies in music. He became a glowing admirer of German music, especially Richard Wagner and Anton Bruckner. Stenhammar himself described the style of his First Symphony in F major as "idyllic Bruckner". He subsequently sought to emancipate himself and write in a more "Nordic" style, looking to Carl Nielsen and Jean Sibelius for guidance The latter's Symphony No. 2, especially, had a great effect on him, leading him to change his style and withdraw his own First Symphony from performance. Having seen Sibelius's symphony performed in Stockholm, Stenhammar wrote to him:
The result of his search for a new style was the Second Symphony in G minor, composed nearly twelve years after the First Symphony, which shows the influence of Nielsen, Sibelius and Franz Berwald among others.
In autumn of 1892, Stenhammar moved to Berlin for seven months to study with Heinrich Barth, where he devoted his time to rigorous piano practice and composition. Barth was satisfied with Stenhammar's performances and gave him increasingly technically challenging pieces to practice, such as the Variations on a Theme of Paganini by Johannes Brahms, a composer he admired.
From 1906 to 1922 Stenhammar was Artistic Director and chief conductor of the Gothenburg Symphony, the first full-time professional orchestra in Sweden. In this capacity, he organised many performances of music by contemporary Scandinavian composers. In 1909, he briefly held the position of director of music at Uppsala University, where he was succeeded the following year by Hugo Alfvén. After moving back to Stockholm in the early 1920s, he returned to touring despite his declining health.
Wilhelm Stenhammar died of a stroke at 56 years of age in Jonsered in the historic province of Västergötland. He is buried in Gothenburg.