Wonka is a big-budget prequel that nobody asked for but that few will deny its confectionary pleasures, starting with the film’s aptly chosen star. Timothée Chalamet exudes wide-eyed, loose-limbed charm as chocolatier Willy Wonka struggling to set up his first shop as a twentysomething orphan. Curiously, he flashes no hint of the menace or cynicism that Gene Wilder famously brought to the role in the original 1971 film, which was drawn from an equally edgy portrait in Roald Dahl’s original novel. But he’s living embodiment of whimsy and self-confidence throughout the two-hour running time.

This is the odd sort of origin story, too, since we meet young Wonka when he’s fresh off the boat but already in full command of his chocolate-making talents — needing only a consumer base to spread his handiwork. He’s the perfect hero for the social-media age: We never see his trial-and-error labors over the act of invention, only the marketing challenge of winning over fans. No wonder he seems so unflapped all of the time.

This sunshiny Wonka is surrounded by an overstuffed mostly British cast that includes a plumped-up Keegan-Michael Key, Olivia Colman (in full camp villain mode), and Hugh Grant (who goes all in as a diminutive Oompa Loompa). Winsome newcomer Calah Lane plays an adorable orphan girl who serves as both a sidekick and tutor in his battles against the oppressive chocolate cartel.

Paul King, the filmmaker behind the two justly praised live-action Paddington movies, brings visual flair to the enterprise, which boasts several well-choreographed production numbers and new songs (by Neil Hannon) that mesh nicely with classics like Leslie Bricusse and Anthony Newley’s “Pure Imagination.” (As a singer, Chalamet proves mostly game.)

The candy-colored visuals go a long way to compensate for a script (by King and Simon Farnaby) that can be a muddle, stretched taffy-thin by too many villains, subplots and characters who are not given much to do. Probing too closely into the story will reveals gaps bigger than blueberry-bloated Violet Beauregarde from the original film. For instance, what is one to make of the flashbacks to young Willy’s world travels with his mother (Sally Hawkins), who apparently taught him the culinary arts but not the basics of reading — and then left him a hand-written note of encouragement that he couldn’t possibly puzzle out for himself?

But it seems churlish to quibble about the shortcomings of a film that packs this much charm and visual wit, from an accordionlike contract full of fine print to a mama giraffe recruited into one of Willy’s schemes. Despite your better judgment — who needs better judgment anyway? — you may find yourself surrendering to some old-fashioned movie magic and plunging yourself into a world of, yes, pure imagination.