It does not directly mention an artificial food generator, but I think it is close and is is from the father of science-fiction:
Jule Verne together with his son Michel wrote in "In the Twenty-Ninth Century: The Day of an American Journalist in 2889" (Au XXIXme Siecle: La Journée d’un Journaliste Américain en 2889, first appeared 1889, but later modified and published again in 1891) about two things that come close to a food generator. The story is about Francis Bennet, the owner of the "World Herald" (formerly "New York Herald") and a normal day in his life. The Vernes actually anticipate quite a lot of developments and technologies. You can find the full text here.
The first thing about food production that he mentions is not really clear to me. It seems more like a distribution system for pre-cooked food, but might also be a replicator:
Like everybody else in easy circumstances nowadays, Francis Bennett, having abandoned domestic cooking, is one of the subscribers to the Society for Supplying Food to the Home, which distributes dishes of a thousand types through a network of pneumatic tubes. This system is expensive, no doubt, but the cooking is better, and it has the advantage that it has suppressed that hair-raising race, the cooks of both sexes.
Later Bennet is approached by inventors and owners of start up companies, requesting his opinion and funding. One of these inventors found a way to transform all kinds of matters from one into another and even claims that creation of humans is possible:
'Sir,' he began, 'though the number of elements used to be estimated at seventy-five, it has now been reduced to three, as no doubt you are aware?'
'Perfectly,' Francis Bennett replied.
'Well, sir, I'm on the point of reducing the three to one. If I don't run out of money I'll have succeeded in three weeks.'
'Then, sir, I shall really have discovered the absolute.'
'And the results of that discovery?'
'It will be to make the creation of all forms of matter easy - stone, wood, metal, fibrin . . .'
'Are you saying you're going to be able to construct a human being?'
'Completely ... The only thing missing will be the soul!'
'Only that!' was the ironical reply of Francis Bennett, who however assigned the young fellow to the scientific editorial department of his journal.
He does not mention food, but all kinds of matter, hence describes a replicator. If the guy gets his funding from Bennet and he gets it to work, he might be building the first replicator of science-fiction history.
Off the top of my head (and therefore probably not the earliest)
Some of Niven's stories (e.g. At the Core) from the 70's have "autochefs" that seem to synthesize food on demand. Note that these are definitively not general purpose replicators: just moderately capable food synthesizers.
Tom Swift and the Space Solartron had a way of generating water, oxygen, and components of food via a cyclotron of some sort. (The energy that relativity requires to accelerate closer and closer to the speed of light became stable mass, even after the items slowed down).
This is from 1958 (Second Tom Swift series. My local used book store has some of the first series, but wants $600 a book for it.)
I can not say with authority (still working on reading everything) however, please take a look at this:
Charles Tanner's Tumithak of the Corridors (1932) describes a post-invasion underground society where ancient machines manufacture food from rocks. Neat trick, no?
The original Buck Rogers comic strips had several instances where humans created food (and other material goods) through the use of "Electical Rays".
That was in the 1920's so it doesn't beat the Verne reference.