What are the most glaring examples -- if any -- of when the professional scientists or mathematicians were wrong, but the nonprofessionals were right?
It seems ball lightning was disbelieved by scientists until around 1960. See Wikipedia .
I knew a geologist who told us how his eye-witness account of ball lightning had been ridiculed. He had learned not to mention it when he interviewed for jobs as a professor of geology.
In 1726's Gulliver's Travels, Jonathan Swift mocked the learned scientists of Britain for not having solved the Longitude problem: Figure out a way to keep track of one's east-west location to within a mile after making a round-trip across the Atlantic. This was one of the most important scientific challenges of the 18th century. The British Parliament had an outstanding offer of £ 20,000 for a solution, and had trusted the astronomers at the Royal Observatory with awarding the prize. The prize was worth several times the modern-day Nobel Prize, and was famous at the time.
In 1731, a watchmaker named John Harrison solved the problem. The astronomers at the Observatory refused to believe him. Over the next 40 years, Harrison steadily refined his solution, but the astronomers never did award him the prize. It took an act of Parliament in 1773 before Harrison was finally given his prize, and east-west navigation could be made safe.
This isn't a topic I'm familiar with, just something I've read on Quanta, but according to this article, Richard Kershner of Johns Hopkins claimed to have a complete classification of convex pentagon tilings in 1968, though he notably said that "The proof that the list in Theorems 1 and 2 is complete is extremely laborious and will be given elsewhere" and that "a complete proof would require a rather large book".
However, after Martin Gardner talked about this claim in his column in Scientific American in 1975, it got to Marjorie Rice, a California housewife with a high school math education, who found four additional families, and Richard James, a computer programmer, who found another. Eventually, Michael Rao proved that there were exactly 15. You can read more about Rice in this article by the same author.
Admittedly, this is an instance of a single professional mathematician making a false claim without giving a proof, which mathematicians consider poor form, and a nonprofessional correcting him, rather than the general mathematics community being wrong.
I think a famous example is the Monty Hall problem` https://en.wikipedia.org/wiki/Monty_Hall_problem about switching doors. The problem was answered correctly by Marilyn vos Savant, but she got baskets of letters from experts that she is wrong.
Take meteorites, for instance. By the end of the XVIIIth century, educated people “knew” that no rock found on Earth could possibly have fallen from the sky, in spite of the evidence (eyewitnesses included) for their existence. As science journalist Kat Eshner wrote, “eighteenth-century rationalists […] thought the stories of rains of iron rocks weren’t real”. This state of affairs lasted until 1803, when Jean-Baptiste Biot established the reality of meteorites.
Just warning not to include pre-1920s medicine (and a lot of medical mantra thru the 20th century), as there was little to no science involved amongst physicians. Just look at how difficult it was for Lister et. al. to convince hospitals, midwives, etc. to wash their hands and sterilize operating theatres.
There are dozens of incorrect anecdotes purporting to show scientists were wrong. The "bumblebee can't fly" is one such. The truth behind the science/engineering theories is rather different.
The Green Flash was described for the first time (at least in the Western literature) by Jules Verne, a science fiction writer. Many scientists did not believe until photographs were taken and published.
Herbert Wells in 1914 described the use of nuclear energy for both bombs and peaceful applications. (His novel The world Set Free). At approximately the same time many scientists thought this was impossible. (Rutherford is on record for saying this publicly, that nuclear energy will be never used).
I'd be tempted to add Gregor Mendel (whose experiments on plants and his analysis demonstrated how genes work) to that list.
It wasn't so much that the 'professional' scientists of the time considered that he was wrong - rather that they didn't even know of his results. In particular Darwin puzzled over what the mechanism for transfer of traits was and was searching for a reason why traits wouldn't be continually diluted ... which was an answer that Mendel had already answered very neatly. (Darwin argued for pangenesis as he was sure from his observations that blending inheritennce would have diluted distinct traits)
I'd argue that Mendel would meet the criteria as being a 'non-professional' as while he did teach physics - he repeatedly failed the teaching exams so he wasn't qualified to teach high school or adults - only young children. A pedant may point out that as presented his experiments in a couple of meetings and published an ignored paper he should be regarded as a 'professional scientist' .. but since he own boss in the church banned him from studying mice as it was considered wrong to study animal reproduction - I'd safely argue that it was a very non-scientific profession he was in.
Mathematicians have been looking for amicable numbers for millenia. The smallest pair $(220, 284)$ was known to the Pythagoreans, and several larger pairs and a formula for generating them were found by Hindu and Arab mathematicians during the Middle Ages. Fermat, Descartes, and Euler rediscovered some of these and found some more.
But in 1866, a 16-year old schoolboy, Nicolo I. Paganini (no relation to the composer) found the previously unknown pair $(1184, 1210)$, which is actually the second smallest.
The Mpemba effect,
named after a Tanzanian student who discovered that a hot ice cream mix freezes faster than a cold mix in cookery classes in the early 1960s
was initially ridiculed. Quoting the wiki page on this topic:
After [a lecture by Dr. Denis G. Osborne], Erasto Mpemba asked him the question, "If you take two similar containers with equal volumes of water, one at 35 °C (95 °F) and the other at 100 °C (212 °F), and put them into a freezer, the one that started at 100 °C (212 °F) freezes first. Why?", only to be ridiculed by his classmates and teacher. After initial consternation, Osborne experimented on the issue back at his workplace and confirmed Mpemba's finding. They published the results together in 1969.
Rogue/Freak waves. It seems that reports of these were considered myths by science for a long time until they were finally recorded.
(However this is not an exact answer to the question - no non-professional had a theory about these waves, it was more of "ignoring observed facts which don't fit the accepted theory)