For me it mostly happens when I press play on my airpods. If they connect to my mac instead of my phone it opens up apple music if I don't have another media player open.