Jannik Sinner rallied past Daniil Medvedev in five sets to claim his first Grand Slam title.