I don't know the first use of the time rogue planet or the first use of such planets called something else.
But if science fiction is anything to go by, rogue planets are as thick as fleas in interstellar space and they are all heading for Earth's solar system.
The Wanderer (1965) by Friz Leiber involves a planet entering the solar system and causing devastation on Earth.
The Fifth Planet (1963) by Sir Fred Hoyle and Geoffrey Hoyle involves another star passing close to ours, and an expedition to a planet of that star.
Battle of the Worlds (1961) is a movie in which a rogue planet called "The Outsider" enters our solar system heading toward Earth.
Back in the 1960s I read a juvenile science fiction novel in which a planet with human like inhabitants entered the solar system. I don't remember the title or author, but it is in the future when Earth has space travel, and strange spaceships are seen. The boy protagonist becomes friends with a boy from the alien planet. I remember a scene where an Earth spaceship was struck by an energy beam hear its needle nose, and incandescent vapor sprayed out from the ship. I think that the aliens looked like humans with orange skin. This book could be the Winston science fiction The Mysterious Planet, 1953, by Kennith Wright (Lester Del Rey).
In The Secret of the Ninth Planet, 1959, by Donald A. Wollheim, it is discovered that there are Plutonians and they are up to no good. It is discovered that Pluto was lost from its original star system and wound up in our solar system.
In The Mysterious Planet, 1953, by Kenneth Wright (lester Del Ray), a new planet, Planet X, is entering the solar system and there are mysterious attacks by space pirates on Earth spaceships. This is a Winston juvenile science fiction novel, and possibly the one I mention two paragraphs above.
When Worlds Collide (1951) is a movie based on the novel, Two rogue planets named Bellus and Zyra are entering the solar system and Bellus will collide with Earth.
The Man From Planet X (1951) has an alien land in a small village in Scotland. Apparently he is from a rogue planet passing through our solar system.
In Chapter One, "The Planet of Peril", of the movie serial Flash Gordon (1936) The planet Mongo is headed on a collision course with Earth.
The planet Mongo is on a collision course with Earth. Dr. Alexis Zarkov takes off in a rocket ship to Mongo with Flash Gordon and Dale Arden as his assistants. They find that the planet is ruled by the cruel Emperor Ming, who lusts after Dale and sends Flash to fight in the arena. Ming's daughter, Princess Aura, tries to spare Flash's life.
As I remember, Ming says he controls the course of Mongo. When Ming says he plans to destroy Earth Dr. Zarkov asks him why destroy Earth, why not conquer it, and Ming agrees. So presumably Ming changes the course of Mongo and the planets don't collide.
The Flash Gordon Sunday newspaper comic strip ran from 1934 to 2003, and a weekday Flash Gordon comic strip ran from 1941-44, and 1951-1993.
The comic strip follows the adventures of Flash Gordon, a handsome polo player and Yale University graduate, and his companions Dale Arden and Dr. Hans Zarkov. The story begins with Earth threatened by a collision with the planet Mongo. Dr. Zarkov invents a rocket ship to fly into space in an attempt to stop the disaster. Half mad, he kidnaps Flash and Dale and they travel to the planet. Landing on the planet, and halting the collision, they come into conflict with Ming the Merciless, Mongo's evil ruler.
When Worlds Collide (1933) is a novel by Philip Wylie and Edwin Balmer, in which planets Bronson Alpha and Bronson Beta enter the solar system, with Bronson Alpha on a collision course with Earth.
In "Wandl the invader" Astounding Stories (1932, book version 1961), by Ray Cummings, the tiny planet Wandl is sent from another star system to invade our solar system.
A comment mentioned rogue planets in works of Olaf Stapledon. Possibly one or more might be in Last and First Men (1930).
In "A Brand New World" Argosy All-Story Weekly (1928, book version 1964) by Ray Cummings, a new planet with humanoid inhabitants wanders into our solar system. If I remember correctly, the new planet is named Xeneprene.
In "The Star" by H.G. Wells (1864), a star enters the solar system on a collision course with the Sun and causes great damage when it passes close to Earth.
This story is often credited with having created a science fiction subgenre depicting the impact event of a planet or star colliding, or near-colliding with Earth—such as the 1933 novel When Worlds Collide by Philip Wylie and Edwin Balmer (made into a film in 1951), Fritz Leiber's The Wanderer (1965), and Lucifer's Hammer by Larry Niven and Jerry Pournelle (1977).
However, it was preceded by two stories in 1894: Omega: The Last Days of the World by Camille Flammarion (the astronomer of the Flammarion Catalog) and Olga Romanoff or, The Syren of the Skies by George Griffith. In 1895, Griffith used an comet disaster again in The Outlaws of the Air.
I note that the comets that strike Earth in the Flammarion and Griffith stories are not necessarily described as from beyond the solar system. By the 1890s it was probably realized that the vast majority of comets are solar system objects in orbit around the Sun.
I believe that Edgar Allen Poe wrote a sort story in which humans became extinct or Earth was destroyed, possibly by collision with another astronomical body. This may be "The Conversation of Eiros and Charmion" 1839, in which two spirits of dead persons discuss the past destruction of the Earth by a comet. I don't know if the comet was supposed to be a solar system comet or a rogue comet.
And those are all the examples I could remember or dig up.
In real life interstellar objects should often pass through the solar system, most of them tiny asteroids and comets ejected from their star systems. A number of candidates for those objects have been suggested, and there are two confirmed cases: Oumuamua, an extra solar asteroid in 2017, and 21/Borisov, an interstellar comet in 2019.