The mercurial Australian unleashed a profanity-laced tirade at the chair umpire, Fergus Murphy.
Kyrgios won the opening set despite foot and ankle issues, but after a rant he threw his towel over a camera, forcing the broadcasters to switch to an overhead view.
After Khachanov won the second set, Kyrgios shouted: "The worst f***ing ref ever, the worst ref in the game.
"The worst, hands down. Every time I play he's doing some stupid s***, every time."
Wimbledon 2019 best pictures
Show all 45
At the end of the match Kyrgios unleashed on Murphy again, saying: "You're a f***ing tool bro."
Khachanov now moves on to the third round and will take on Frenchman Lucas Pouille, who beat Canadian Denis Shapovalov 6-4, 6-4.
Kyrgios is likely to face disciplinary action for his outbursts.
Earlier, Alexander Zverev hit 20 double faults in a bruising loss to 19-year-old qualifier Miomir Kecmanovic.
The German has had a poor season and this was another low point, Kecmanovic benefiting from his opponent's wayward serving in a 6-7 (4), 6-2, 6-4 victory, his first over a top-10 player.
The bottom half of the draw is wide open, with fourth seed Kei Nishikori another big name to fall.
Nishikori lost an all-Japanese clash with Yoshihito Nishioka, who defeated a man he calls his hero 7-6 (2), 6-4 for the biggest victory of his career.
Third seed Stefanos Tsitsipas is in the top half but was not immune to the upsets, recovering from a set and a break down against German Jan-Lennard Struff only to lose 6-4, 6-7 (5), 7-6 (6).
Seventh seed Daniil Medvedev continued his good form by beating Benoit Paire 7-6 (2), 6-1 but Stan Wawrinka was ousted 6-4, 6-4 by qualifier Andrey Rublev.
PA
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies