The 20-year-old had come into the tournament on the back of triumphs in Barcelona and Madrid and will replace Novak Djokovic as world No.1 to take top billing at Roland Garros later this month.
But Alcaraz was far from his best on Monday and got off to a shaky start in his second match in Rome, dropping serve to love in the fourth game. World No. 135 Marozsan built a big lead and dominated the late exchanges to easily win the opening set.
Marozsan continued to heap the pressure and broke for a 4-3 lead after Alcaraz saved three break points earlier in the second set, but the 23-year-old Budapest native immediately let his opponent off the hook.
The set went to a tie-break in which Alcaraz raced to a 4-1 lead, but Marozsan hit back in superb style to reel off six points and hand the world No.2 only his second defeat on clay in 22 matches this season.
"It's not easy to say something," Marozsan said after the biggest win of his career. "I'm very happy, I could have never imagined this. It was my dream last night.
Marozsan, playing in the main draw of an ATP tournament for the first time, added: "I said I'd try to do something special by winning a few games and maybe a set - and I just beat the best player in our sport now.
"Everything was perfect today."
It was the first defeat for Alcaraz to a player ranked outside the world's top 100 since the 2021 Paris Masters when he fell to Hugo Gaston.