Reputation: Like Dory from the film Finding Nemo, fish are amnesiacs that forget things in seconds. They do little more than swim around, aimlessly waiting to become supper.

Reality: The slippery creatures are actually as smart as apes on some measures. They are capable of remembering details for years, and are better at judging space than humans.

There is something fishy about our attitude to fish. It is estimated there are a staggering 250,000 species of fish in our oceans, yet despite their diverse looks and behaviour, many people perceive them to be universally dim-witted.

The widely-held belief that fish have three-second memories has been blown out of the water

This widely-held belief may persist due to an unconscious bias, based on an old-fashioned view of how evolution works. Culum Brown of Macquarie University in Australia, who is also assistant editor of the Journal of Fish Biology, suspects that many people underestimate how smart fish are because they assume fish are primitive creatures. "The reality is that most of the fish on the planet today evolved around the same time as humans," he says.

It is also possible we subconsciously underestimate the cognitive abilities of fish because they live in such a different habitat to our own; because we have been duped by films that perpetuate the myth that fish are amnesiacs; or because we simply assume they are unintelligent to avoid feeling guilty when tucking into a fish finger sandwich.

In Finding Nemo, Dory the forgetful blue tang (Paracanthurus hepatus) tells Nemo: "I suffer from short-term memory loss… I forget things almost instantly." However, the widely-held belief that fish have three-second memories has been blown out of the water by animal behaviour experts.

The humble goldfish can remember things for three months, and can even tell the time in a rudimentary way. For a 1994 study, researchers trained goldfish to push a lever that worked for one hour a day in exchange for a reward. The fish learned to take advantage of this window of opportunity, demonstrating that they could keep track of time, learn and remember.

The fish's performance was surprising and could be compared to that of rats

This will come as no surprise to owners of pet goldfish that beg for food at the water's surface. Study author Phil Gee of Plymouth University in the UK says fish's ability to anticipate food gives them "a competitive edge and an evolutionary advantage".

Brown says many fish can recall details for a very long time. For instance, the crimson-spotted rainbowfish (Melanotaenia duboulayi) can remember escape routes to evade danger for 11 months, according to a study he published in 2001.

"Most aspects [of] their cognitive abilities are just as good as most terrestrial animals, and in many cases exceed them," says Brown.

Guppies (Poecilia reticulata) can solve a maze consisting of six consecutive T-junctions. The popular pets not only learned to complete the puzzle, but over a five-day training period they got faster and made fewer errors, according to a study published in February 2017.

The fish's performance was surprising and could be compared to that of rats, says lead author Tyrone Lucon-Xiccato of the University in Padova in Italy. "Rodents are expected to be successful in similar tasks because they have evolved to live in burrow systems similar to that of a maze. But conversely, fish usually live in very different environments and therefore were not expected to rapidly learn the maze."

He says guppies may have evolved their navigational abilities because, in the wild, they live in streams that are strewn with obstacles.

Fish, like mammals, have an excellent sense of space. They draw on incoming sensory information such as hydrostatic pressure to work out their position in three-dimensional space, according to a 2016 study.

Theresa Burt de Perera of the University of Oxford says that fish can encode space in 3D, whereas land-dwelling animals like us have trouble with the vertical dimension. Unlike rats, fish can accurately judge vertical distance.

As well as navigating, fish can use tools

Brown says fish's ability to track depth makes them "superior to humans" in this respect.

There is also tentative evidence that fish have something similar to "place cells". These cells, which have been found in rats, are neurons that fire when the animal occupies a specific location within its environment. Different place cells fire in different locations, so they are thought to be the seat of a neural map of space in mammals.

The apparent fish "place cells" are in an area of their brain that is equivalent to the human hippocampus. The fish might use them to create a memory of the space around them.

As well as navigating, fish can use tools – a skill once thought to belong exclusively to humans.

Several of the brightly-coloured marine fish called wrasses crush sea urchins against rocks to access the meat inside. Meanwhile, South American cichlids and hoplo catfish (Hoplosternum thoracatum) glue their eggs to leaves and small rocks, which they use as portable nurseries if their nests are under threat, according to a 2012 review paper by Brown.

Archerfish can also discriminate between human faces, a task previously only accomplished by primates

Perhaps the most impressive tool-using fish is the archerfish (Toxotes chatareus), which uses water as a tool or weapon, much as we might throw a ball. The fish squirts a jet from its mouth like a water pistol to hit insects above the water's surface. It even takes light refraction into account.

Stefan Schuster of the University of Bayreuth in Germany is a leading authority on archerfish. He has demonstrated that juvenile archerfish appear to learn the complex hunting method by watching more experienced hunters – even though they do not have a brain region called the neocortex, which is associated with sight in mammals.

After taking a shot and hitting its target, the archerfish calculates where its dinner will land and sets off at top speed to grab it ahead of its rivals. It can do this in as little as 40 milliseconds. "These decisions are most remarkable in their combination of speed and complexity," says Schuster.

In a sense, the archerfish is performing ballistics calculations. But of course, it is "doing the maths" at an intuitive level, much like a good footballer can quickly make a perfect pass and anticipate where another player will receive it, without working out trajectories.

Archerfish can also discriminate between human faces, a task previously only accomplished by primates.

Numerical abilities might be at least partially displayed at birth

They can pick out a familiar face from a sea of 44 new faces, according to a 2016 study. Researchers trained the fish to identify a familiar face by shooting it with a jet of water, and discovered that they could make the distinction up to 89% of the time.

"The fact that archerfish can learn this task suggests that complicated brains are not necessarily needed to recognise human faces," says author Cait Newport of the University of Oxford.

Gee says there is a chance pet goldfish may be able to recognise their owners' faces, although there is no evidence so far – and wild goldfish live in murky waters, which may mean they do not rely on vision as much as archerfish.

However, much like birds, fish can distinguish between quantities.

In a 2013 study, researchers found that newborn guppies can choose the larger of two groups of dots. "The fact that newborn fish can learn to distinguish between two groups of objects differing in number reinforces the idea that numerical abilities might be at least partially displayed at birth," says author Christian Agrillo of the University of Padova.

The trout and grouper both shake their heads to invite a moray to come hunting

Judging quantities is important for fish, because they often avoid predators by joining large shoals. Several studies have shown that fish prefer to join the larger of two shoals when placed in an unknown environment.

Agrillo believes fish are as adept at quantifying small groups as mammals and birds. If that is true, it would suggest that our numerical abilities may be older than we thought. They could even date back to the divergence between fish and land vertebrates, approximately 450 million years ago.

As well as "counting", fish can work together – even with members of other species.

Coralgroupers (Plectropomus pessuliferus) and coral trout (Plectropomus leopardus) both sometimes team up with snake-like giant moray eels (Gymnothorax javanicus) to flush out prey that are hiding in small crevices.

The trout and grouper both shake their heads to invite a moray to come hunting.

Impressive brainpower evolved long before humans

In a 2014 study, biologists showed that coral trout quickly learn to choose the most effective eel hunters. They used a set-up in which food was out of reach. The trout quickly worked out when they needed a collaborator to help them get the food, and they were three times more likely to choose an effective moray teammate over an ineffective one.

The experiment "strengthens the case that a relatively small brain, compared to warm-blooded species, does not stop at least some fish species from possessing cognitive abilities that compare to or even surpass those of apes," says study author Alexander Vail of the University of Cambridge.

A goldfish aimlessly circling its bowl may not be as smart as this. But archerfish and other species are helping to challenge our perceptions of fish intelligence. Schuster says this should put our own cognitive abilities into context, because clearly impressive brainpower evolved long before humans.

However, it remains to be seen whether our newfound appreciation of fish intelligence will ever be enough to put us all off eating fish and chips.

Join over six million BBC Earth fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Capital, Culture, Earth Future and Travel, delivered to your inbox every Friday.