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.
The second set went to a tiebreaker in which Alcaraz raced to a 4-1 lead, but the 23-year-old Budapest native hit back to reel off six points and hand the world No.2 only his third defeat in 33 matches this season, and first in 13.
"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.
"I just didn't feel comfortable. He made me to feel uncomfortable on court," Alcaraz said.
"He was aggressive all the time. He was playing inside the baseline all the time. It was tough for me to get into the match, into the rally. I made a lot of mistakes that I usually don't make too much.
"He was at the same level the whole match. That is very, very difficult. He deserves the win. If he plays at that level, he's going to surprise more than one (player)."
Marozsan will next face Borna Coric, who continued his solid form on clay by beating Roberto Carballes Baena 7-6 (7-3) 6-1. At the Madrid Open last week, Coric reached the semi-finals before losing to Alcaraz.
World No.3 Daniil Medvedev earned a hard-fought 3-6 6-1 6-3 win over Spain's Bernabe Zapata Miralles to reach the last 16 in Rome for the first time.
"I'm definitely playing my best tennis on clay right now," said Medvedev, who reached the quarter-finals in Monte Carlo and the last 16 in Madrid.
"I have never played so well in Rome or in Madrid. I'm feeling great."
Monte Carlo Masters champion Andrey Rublev defeated Alejandro Davidovich Fokina 7-6 (10-8) 6-3 and will next play German qualifier Yannick Hanfmann, who beat former French Open semi-finalist Marco Cecchinato 6-4 4-6 6-3.
Rain then intervened, forcing the suspension of several matches.
Lorenzo Musetti was up 5-7 6-4 2-1 and a break against Frances Tiafoe. Stefanos Tsitsipas had won the first set against Lorenzo Sonego 6-3 and Alexander Zverev was leading J J Wolf 6-4 3-3.
Alexei Popyrin, who came through qualifying to be the last Australian in the event, is now scheduled to begin his third round match against Danish No.7 seed Holger Rune at 7pm (AEST) on Tuesday.
- with AP