The Rod of Discord is a rare Chaos Elemental drop in the Underground Hallow. Here is where they spawn, how to farm them faster and how to turn the rod into the Rod of Harmony.
You get the Rod of Discord in Terraria as a rare drop from the Chaos Elemental, a Hardmode enemy in the Underground Hallow. The drop chance is 1 in 500 (0.2%) in Classic and 1 in 400 (0.25%) in Expert and Master, so expect a long farm.
The Rod of Discord teleports you to your cursor, through walls and blocks. It is one of the best mobility items in the game and makes many Hardmode bosses, the Moon Lord included, much easier to dodge.

Chaos Elementals only spawn in Hardmode, in the Cavern layer of the Underground Hallow. These are the spawn conditions:
The Underground Hallow usually sits under the surface Hallow in a wide V shape. If your world has a small one, spray Hallowed stone into the Cavern layer with a Clentaminator and Blue Solution to make your own spawn area.

The Chaos Elemental has 370 health and 30 defense in Classic, 740 health in Expert and 1,110 in Master. It hits for 40 damage (80 in Expert, 120 in Master) and teleports next to you, so it is not hard to kill once you have early Hardmode gear.
These are its drops:
Note: Every 50 kills gives a Chaos Elemental Banner, which makes you deal more damage to them and take less from them. Hang it in your farm.
The farm is a numbers game, so the goal is to see as many Chaos Elementals per minute as possible. A good setup:
The Shadow Candle is the best tool for this farm. It lets Chaos Elementals and other enemies spawn even in front of player walls, so you can build a safe box around yourself. Craft one from 3 Demonite or Crimtane Bars and a Torch.
Chaos Elementals also only spawn while you have moved or used an item in the last 5 seconds, so stay active. The Shadow Candle removes this rule as well.

Use the Rod of Discord and you teleport to your cursor. It works through blocks and reaches up to 60 tiles sideways and 37.5 tiles up or down, so it is also great for leaving a cave or reaching a floating island.
Each use gives you the Chaos State debuff for 6 seconds. Teleporting again while it is active costs you 1/7 of your maximum health, so don't spam it. With high health and good Life Regeneration you can still chain a few teleports in an emergency.

After you beat the Moon Lord, throw the Rod of Discord into Shimmer to turn it into the Rod of Harmony. It works the same way but has no Chaos State at all, so you can teleport as often as you click.
That makes it the best travel item for building and exploring. For where the Shimmer is, see How To Find The Shimmer, and for the boss you need to beat first, see How To Summon Moon Lord.
Note: Teleporting into a closed space can leave you stuck in blocks. Aim at open air, and keep a Magic Mirror or Shellphone in case you misclick.