Two answers:
1945
It didn't
These answers depend entirely on what you mean by "primary". If you're talking about which language is the majority language, it's still Taiwanese/Hoklo/Hokkien/閩南/台語. That's the language most people have as their mother tongue, regardless of how we're defining that particular can of worms. Most taiwanese still speak that at number one. Number two is unequivocally Mandarin, the language of education, government, the military, stuff. But it's not yet the primary language of at-home conversation. But give it time.
Then 1945. In 1945 the Japan gave Taiwan to the KMT from the Japanese. From then to 1947 the KMT instituted all their plans to rid the country/island of Japanese and make Mandarin both the de jure and de facto language. It went okay. 1947 saw the 228 incident (so named for being on February 28) which resulted in a lot of Taiwanese people dying at the hands of soldiers send by the KMT government. Was this really just about language? No. Was language policy a huge part of it? Yup. Inline tldr: Japan Japanified Taiwan linguistically in three stages and it went really well, relatively speaking. By 1945 aboriginal people had good jobs using Japanese and despite all the other terrible stuff that happened under Japanese occupation, by the end of WWII things were stable and relatively okay. Then the KMT was like no! and made Japanese not okay in public life more or less overnight, meaning all the high class people who were cool using Japanese and the aboriginal people who needed Japanese to do their jobs were suddenly not able to do that. People were angry. People protested. The White Terror began. Chen Yi was the guy in charge of this. He didn't last long. His efforts to enact KMT policies resulted in a loss of position for Japanese0speaking members of indigenous groups and ethnic Han elites. Followed by rising anti-government sentiments ultimately peaking in 1947 with the 228 Incident.
It wasnt until 1987 that punishments for using languages other than Mandarin were revoked. It wasn't until 1993 that these "minority" languages could be taught. It wasn't until a few years later that you got the founding of the Council of Indigenous Peoples and Council for Hakka Affairs. And it wasn't until 2016 that the government really apologised for how crap they were about the whole thing, with Tsai Ying Wen's inaugural address.
So how did Mandarin become the thing? Oppressive policies toward any language but Mandarin. Serious indoctrination through the military and obligatory conscription. Criminalisation of using non-Mandarin languages. Lots of efforts by the KMT and the Provincial Committee for the Propagation and Promotion of the National Language (PCPPNL) and general control of the education system.
Basically, as a national standard, due to political reasons nothing but Mandarin stood a chance, though how effective it was is to be argued since around 60% of the country's population still speaks Taiwanese at home. Still, as for being a national standard, Mandarin has been it since the mid 1940s.
edit: Fixed a stupid mistake. Don't answer questions late at night when you've been out at the pub.