"Merry Andrew: MERRYMAN. The jack pudding, jester, or zany of a mountebank, usually dressed in a party-coloured coat.
--1811 Dictionary of the Vulgar Tongue, by Francis Grose.
A Merry Andrew is a somewhat mysterious type of clown. The Merry Andrew was a fixture of the Bartholomew Fair for centuries, presumably being the 17th century equivalent of a stand-up comedian.
"August 29. Met my wife in a coach, and took her and Mercer and Deb. to Bartholomew Fair; and there did see a ridiculous obscene little stage-play called Marry Andrey, a foolish thing, but seen by everybody."
--Diary of Samuel Pepys, 1668
Throughout the years there are references to actors starting their careers, or sometimes building a whole career, on playing Merry Andrew. We do not, however, know what this entails. There is a persistent but apparently baseless myth that the original Andrew was Andrew Borde (c. 1490-1549), an English physician and writer; he is credited with some humorous writings (although even these are uncertain), and he was well-known enough that he could be the source of a new phrase; however, we simply don't have any information to back this up.
Frustratingly, while the origins of Merry Andrew may always have been a bit of a mystery, his act was not. Not only did thousands of people witness performances that were clearly identified as Merry Andrew acts, not only do we have multiple references in writing to their existence, we even have one page, the title page, of a book that would have cleared up what sort of character Andrew was: The Comical History of the famous Merry Andrew, W. Phill., Giving an Account of his Pleasant Humours, Various Adventures, Cheats, Frolicks, and Cunning Designs, both in City and Country (1688). While this does suggest that he was a trickster of some sort, more than this we do not know.
Regardless, the phrase Merry Andrew lived on for years to denote a clown, a fool (in either sense), or a joker. It may have been used in some circles to refer specifically to a snake-oil salesman or his assistant, as indicated by the Grose 1811 Slang Dictionary, but this was certainly not the only use. It became increasingly rare in the 1800s and 1900s, and by the time the musical film Merry Andrew was released in 1958, the title was most likely a obscure reference that passed by most of the audience.