Pandora Media became a powerhouse in online music primarily by doing one thing: tailoring song after song to the tastes of its listeners, along with the occasional ad. For a decade, it worked well, as Pandora came to dominate Internet radio.

But with its stock price suffering, and as competitors like Spotify and Apple Music transform the streaming music market around it, Pandora has come under increasing pressure to adapt. In recent months Pandora has unveiled ambitious changes to its service, and also weighed whether to sell itself.

On Monday Pandora threw Wall Street another curveball by replacing its chief executive, who had held the job for less than three years, with one of the company’s founders.

Brian P. McAndrews, an online advertising executive who joined Pandora in September 2013 as chairman and chief executive, has left the company, and is being replaced as chief executive by Tim Westergren, a co-founder of Pandora and its former chief strategy officer.