In the 16th century the Italian theatre developed the commedia dell’arte, where comedies developed from ordinary life.
One of these characters in the commedia dell’arte was a clown who mimicked the actions of his principal. The stock name for such a character was Zanni, which developed from the Italian name Giovanni, which in English was a name for John.
By the early 17th century anybody who made a laughing stock of himself to amuse others was called a zany.
From, that developed the meaning of slightly crazy. Over the years the emphasis has been slightly less crazy, but crazy nevertheless.
Zany began life as a corruption of the Italian word for Giovanni, but he was also known as Merry Andrew.
But his name was spelt as zanni.
Commedia dell'arte (which translates as “theatre of the professional”) began in Italy in the early 16th century and quickly spread throughout Europe, creating a lasting influence on Shakespeare, Molière, opera, vaudeville, contemporary musical theatre, sitcoms, and comedy.
Commedia dell'arte is a form of theatre characterised by masked "types" which began in Italy in the 16th century and was responsible for the advent of the actresses and improvised performances based on sketches or scenarios.
The name zany was broadened out to buffoon in the 17th century, but seems to have adopted a slightly softer image.
Previously the clown adopted a slightly awkward, even ludicrously awkward, method. Nevertheless, a crowd of people conducting themselves like fools at a party could be considered as acting in a zany fashion. And I have seen many of them, so I expect have you.
By the time the word entered the English language, it meant any foolish person.
My 1811 Dictionary of the Vulgar Tongue said zany meant “the jester, jack pudding, or merry andrew, to a mountebank”. (A mountebank was a person who deceived others, or behaved as a charlatan.)
Ambrose Bierce in his 1881 dictionary said a zany was a popular character in Italian plays who imitated with ludicrous incompetence the buffoon, or clown “and was therefore the ape of an ape, for the clown himself imitated the serious characters of the play”.
The Collins dictionary says someone who is zany “is strange or eccentric in a comical way”.
Webster says a zany is a “silly person or simpleton”.
The Macquarie says zany represents “an apish buffoon”.
Maybe you would be better off if you steered clear of zany, unless you know the person really well. Maybe not even then.