The Latvian was unable to repeat the heroics of last year, when she became the first unseeded women's champion since 1933, as she lost 7-5, 6-3 to the Ukrainian on the main Court Philippe Chatrier at Roland Garros.
Ostapenko made 48 unforced errors, including 13 double faults against Kozlova, who has now won all of their three matches.
"It was terrible day at the office today for me," Ostapenko said in a news conference. "I mean, in general I played maybe like 20% of what I can play. Made like 50 unforced errors and so many double faults. Like couldn't serve today. Everything together just brought me really bad result."
Unlike Ostapenko, who had been trying to become only the fourth woman in history to successfully defend her maiden grand slam title at Roland Garros, her opponent was able to play without any pressure.
"I didn't expect anything from this match," Kozlova said in a court-side interview. "It's an amazing feeling."
Ostapenko, 20, had taken the French Open by storm last year, producing almost 300 winners during the entire tournament with an aggressive game style that had rarely been seen before in the women's game at Roland Garros.
Venus also out
Earlier in the day, an error-strewn Venus Williams was knocked out of the first round of the French Open by the 91st-ranked Qiang Wang.
The ninth-seeded American lost 6-4, 7-5 to China's Wang on the Court Suzanne Lenglen on hot day in Paris.
After a stellar 2017 season, during which she reached the Australian Open and Wimbledon finals and the US Open semifinals, Williams has now lost two consecutive first-round grand slam matches for the first time in her long career. In January, she was beaten by Switzerland's Belinda Bencic in the opening round of the Australian Open.
"Nobody plans on this," Williams told reporters after the match.
She was full of praise for her opponent, whom she had beaten in the two previous matches they had played, last year at Roland-Garros and at Wimbledon.
"She just played well," Williams said. "All the times we've played, she's played great. I think her game just got better and better during the match."
'Nothing to lose'
"I just tried my best," Wang said in a court-side interview, after losing the match on Williams' 35th unforced error.
"I think today I had nothing to lose," added the 26-year-old, who is coached by former Wimbledon doubles champion Peter McNamara.
A runner-up on the Parisian clay in 2002, Williams hasn't advanced beyond the last sixteen since 2006.
But the tournament isn't over yet for the 37-year-old Williams, who is scheduled to play in the women's doubles event with her sister, Serena Williams, for the first time since they won the 2016 Wimbledon title.
"We haven't played in forever," Venus Williams said. "So I'm hoping that we'll get out there and kind of just start where we left off."
Serena Williams, a three-time winner at Roland Garros, will play her first major match since coming back from maternity leave on Tuesday.
Lucky loser makes history
The other big story of the day belonged to world No. 182 Mohamed Safwat, who was told he would play his first ever grand slam main draw match on the biggest show court of Roland Garros with just an hour to spare.
After losing in the qualifying tournament, Safwat had been put on the so-called 'lucky loser' list of players, who are given the chance to enter the main draw in case of a withdrawal.
When Serbia's Viktor Troicki pulled out of his 11 a.m. match against Bulgaria's Grigor Dimitrov on Sunday morning with a lower back injury, Safwat got his chance.
"I always was dream to play on center court with such a crowd," Safwat told reporters, after losing 6-1, 6-4, 7-6 (1) to the fourth-seeded Dimitrov.
Safwat, the first man from Egypt to play in a main draw match of a major since Tamer El Sawy at the 1996 U.S. Open, said he had never even been inside of the main Court Philippe Chatrier.
"It's something I always saw it on TV, but I never had the experience to see," said Safwat, who got a huge ovation from the crowd after the match. "So it was really, really enjoyable for me."
As for Dimitrov, he was given even less notice.
"I just found out about 30, 35 minutes before I had to go out," Dimitrov said in a news conference. "After my warmup today, I just walked into the locker room, and Viktor was, like, 'Hey, good luck today.'"
Sloane Stephens ended her grand slam drought since winning the US Open last summer with a 6-2, 6-0 win over lucky loser Arantxa Rus of the Netherlands on the new Court 18.
Winning the biggest title of her life took some time getting used to, said Stephens, who posted eight straight defeats, including a first-round loss at the Australian Open, after her New York breakthrough.
But her game finally clicked back into gear during the US hard court swing, where she beat defending French Open champion Jelena Ostapenko for the Miami Open title in March.
"I had to take care of myself," Stephens told a news conference at Roland Garros. "I tried to do way more than I should have after the U.S. Open, and I should have just shut it down. But like I've said before, my heart was there but my body wasn't. So when the two things aren't connected, it's never a good thing."
Although Stephens has never got to the second week in Paris, she reached the last sixteen each year between 2012 and 2015, losing to the eventual champion on three occasions.
Elina Svitolina of the Ukraine, one of the title favorites after retaining her Rome crown the week before Roland Garros, came back from a set point down to beat the unseeded Australian Alja Tomljanovic, 7-5, 6-3.
Other winners on the first day of Roland-Garros included Japan's Kei Nishikori, the second-seeded German Alexander Zverev and France's Gael Monfils.
Britain's Jo Konta, a Wimbledon semi-finalist last year, was beaten in straight sets by Yulia Putintseva of Kazakhstan. Konta has yet to win a match in Paris in four appearances.