The reason Miku usually has a leek with her most of the time when you see her, is because since she is a vocaloid, someone (I guess) wanted to make her sing Ievan Polkka, a Finnish song, and that's what got her popular at first.
And as one of the answers already stated this, these vegetable pairings with Vocaloids came from the fans themselves, so it's not exactly official.
Actually, many Vocaloids (even UTAUs) have been associated with vegetables. Here are some examples:
Megurine Luka - Fish or Tuna
Kagamine Rin - Orange(s)
Kagamine Len - Banana(s)
KAITO - Ice cream
MEIKO - Sake (A traditional Japanese alcohol)
GUMI - Carrot(s)
Camui/Kamui Gakupo - Eggplant
Kasane Teto - (French) Bread or a Baguette
Namine Ritsu - Chocolate Crisps
So Luka is paired with fish because she has a chibi head character who has hair like an octopus.
Rin has an orange for her fruit because her neckerchief resembles an orange peel.
Len was paired with a banana mostly because of his hair color and that piece of his hair sticking upwards resembles a banana, just a bit.
KAITO with ice cream because fans notice the scarf he wears and in his new V3 update, boots. People thought he seemed to wear winter-special clothes and since his hair is blue it easily resembles snow/ice and relating things, they decided his food was going to be Ice cream.
MEIKO with sake because she seemed to look older and mature so I guess they thought it'd be fun if they made her drunk (?) Not quite sure about this one.
GUMI with carrots because of her color scheme mostly, since she has green hair and orange official clothes so it reminds people of carrots.
Gakupo with Eggplant because he has purple hair and a stronger/deeper voice so I think it reminded them of an eggplant
Now, the UTAUs were officially paired with random foods because they were sorta supposed to be a parody April fool's joke. (?)
Here is a picture of them with the foods too: