Nvidia has surpassed Apple to become the world's most valuable company, fueled by soaring demand for its AI technology.