Apple surpassed Nvidia as the world’s most valuable company, but lost the top spot before the close. What’s behind the fight for first place.