There are several reasons why this is the worst possible action:
Exotic pets have the tendency to survive better than anyone would have assumed. There are flocks of tropical birds surviving in temperate metropoles like Berlin, goldfish and turtles growing to gigantic sizes in rivers and lakes all over the world, and exotic (sometimes poisonous) snakes hiding in parks and bushes.
These animals are put into their new environment by humans, not by nature. The flora and fauna didn't adapt to their presence and evolution would need hundreds and thousands of years. Even though most pets are "harmless" herbivores, they are a direct competition to native and endemic animals and start wreaking havoc within a few years of release.
- Eat the food of native animals, causing them to go hungry or even starve
- May not be recognized by local predators as prey. While native animals are hunted and decimated by predators, those invaders can reproduce unhindered.
- Often breed faster than native equivalents (especially goldfish)
- Grow to gigantic sizes ( for example goldfish and turtoises)
- Eat or otherwise kill the offspring of native animals (goldfish eating the eggs of native fishes, reptiles eating birds, birds eating local beneficial insects)
- May eat rare plants in danger of extinction
- Poisonous animals like exotic frogs / toads poison native predators if eaten
In general, pets released into nature tend to suppress native animals, sometimes driving them to the edge of extinction.
Even native animals that were domesticated should not be released. Popular examples are hamsters and wild rabbits in Europe and North America.
These animals depend on human care to survive. Most were born in captivity and never learned from their parents what a wild animal needs to know to survive: What is safe to eat? How to spot a predator and hide from them? How to survive in harsh seasons? Is it safe to walk on a road?
Released domesticated animals tend to suffer from hunger, injuries and illnesses or be killed by predators rather quickly.
How to get rid of unwanted pets?
If you have a common pet like a cat, dog, goldfish or the like, you should either offer it to a pet shop or shelter. People there know how to care for those pets and they have a chance to find a better home.
You can also ask friends, family or neighbors if they might be interested. Especially people who already have a pond or aquarium are likely to adopt another fish.
Problematic or less common pets like exotic reptiles, snails, spiders or birds need to find a place in a specialized shelter or rescue center. Some zoos accept exotic animals if they already have some of the same species or if they can fit them in with the existing ones.
Can I flush it down the toilet?
No. This is animal cruelty and the fish is guaranteed to die.
Imagine jumping down a manhole into your local sewer and taking a dive in the sewage water. No fish or reptile can survive in this water. This is absolute torture and animal cruelty.
And contrary to what Disney films claim, almost all sewers end in a water treatment plant, not in the ocean. Even if an animal could survive in the sewage, it would be caught in the sewer forever or be shredded in a treatment plant.
What if the fish is obviously beyond help?
Please refer to this question What's the least painful way to euthanize a fish? and be aware that freezing is no surefire or painless way to kill a fish, especially for goldfish, who regularly survive winters in frozen lakes.