You have to understand the literal meaning of "box of chocolates". They're not so common anymore, but at one time fancy boxes of chocolate-covered candies were the gift of choice to mothers and wives on the occasion of a birthday, anniversary, Valentine's Day, Mother's Day, etc.
A typical box contained maybe 40 individual unwrapped pieces, neatly arrayed with paper (and later plastic) dividers keeping them from sliding around. But even though the pieces were unwrapped, since they were chocolate covered it was difficult or impossible to tell if a given piece contained nougat filling, or cherry, or nuts, or whatever. (Many later boxes contained a label or "crib sheet" stating what pieces were what flavor, but this information was not commonly present in boxes prior to maybe 1960.)
So, when offered you would take a piece and eat it, unsure of whether the particular piece would be something you like or something you don't like.
Thus, as Forrest's mother said, "You never know what you're going to get." It might be something you really wanted, it might be something that you simply have to tolerate.
(I recall my aged aunt speaking of a friend she had visited who had such a box of chocolates and offered her a piece. When my aunt looked at the box she saw that all of the pieces had been pinched by this friend, in order to break the chocolate slightly and allow the friend to tell what was inside. My aunt found this to be hilarious.)