Anisimova, ranked 60th in the world, saved two match points to stun the former world number one 4-6, 6-3, 7-6 (10/5) and will now face Barty in the last 16.
It was a hugely disappointing end for Osaka in Melbourne, having also gone out at the same stage at the US Open in September, after which she took a break from tennis.
In the men's draw, Rafael Nadal underlined his status as one of the favourites with a four-set victory over Russian 28th seed Karen Khachanov.
But day five at Melbourne Park was all about the 20-year-old Anisimova.
"I'm speechless, I can't stop smiling," she said after sending four-time Grand Slam winner Osaka home.
Osaka attempted to find a positive, saying she can't always win.
"You know, I'm not God," said the dethroned Japanese champion.
Anisimova will be eyeing another scalp in the form of Australia's Barty, who was a comfortable 6-2, 6-3 winner over Italian 30th seed Camila Giorgi, inching closer to a maiden Grand Slam crown on home soil.
"It was a pretty good performance," said Barty, 25, who is now 7-0 for the season and yet to drop a set in Melbourne.
Also into round four is two-time champion Victoria Azarenka.
The 24th seed crushed 15th seed Elina Svitolina as she tries to climb back to the top of women's tennis.
The 32-year-old Belarusian turned back the clock with a 6-0, 6-2 dismissal of her Ukrainian opponent and will now play French Open champion Barbora Krejcikova for a place in the quarter-finals.
"I think that's really what I'm trying to say is that ladder I want to climb step by step," said Azarenka, who won
back-to-back Australian Opens in 2012 and 2013, of her efforts to get back among the elite.
"I think the danger for me is to try to skip a few steps."
Krejcikova overcame a big fright against 2017 Roland Garros winner Jelena Ostapenko.
The Czech dropped the first set and was a break down in the second before coming through 2-6, 6-4, 6-4 and declaring her never-say-die attitude meant her rivals should be afraid of her.
"I hope they are scared of me," said the 26-year-old, who was one of the standout players of 2021, winning three titles as she soared more than 50 places up the rankings.
Fifth seed Maria Sakkari and eighth seed Paula Badosa also went through.
- Nadal enjoys himself -
In the absence of the deported defending champion Novak Djokovic and injured Roger Federer, Spanish legend Nadal is attempting to become the first man to win 21 majors.
He dropped a set for the first time at this tournament but called his 6-3, 6-2, 3-6, 6-1 win over Khachanov under the lights his best performance since he returned this year following a foot injury that ended his 2021 season early.
"I went through some very tough times in the last year and a half, but nights like this mean everything to me," said the 35-year-old, who could face Olympic champion Alexander Zverev in the quarter-finals.
World number three Zverev powered his way into the last 16 with a superb serving display against Moldova's Radu Albot.
The powerful Tokyo Olympic gold medallist thundered down 16 aces to put away the 124th-ranked Albot, 6-3, 6-4, 6-4.
Zverev will next take on Canada's 14th seed Denis Shapovalov.
Also through is Italian seventh seed Matteo Berrettini, who came through a five-set epic against talented Spanish 18-year-old Carlos Alcaraz 6-2, 7-6 (7/3), 4-6, 2-6, 7-6 (10/5).
Flamboyant French 17th seed Gael Monfils, who won the Adelaide warm-up event, continued his great early-season form with a 7-6 (7/4), 6-1, 6-3 romp against 16th-seeded Christian Garin of Chile.