The answer to this question is more interesting than I thought. Now, the part that many people know, or at least should know, is that Philistines are a people in the Old Testament. You heard of David and Goliath? David was an Israelite, later the King of the Israelites, and Goliath was a Philistine. This is one of several battles the Israelites and the Philistines had together. Wikipedia can give you more on the historical Philistines.
But how did Philistine became an insult in English? Well, for etymologies, it's usually safest to turn to the Oxford English Dictionary [unfortunately, it's behind a pay-wall, though most universities will let you in with a proxy server]; Etymonline is the best free alternative.
OED says, that Philistine first meant figuratively, "A member of a group regarded as one's enemies, or into whose hands one would not wish to fall; a foe, a persecutor. Formerly also: †a debauched or drunken person (obs.). Usu. in pl.", starting in the seventeenth century, which is perhaps not coincidentally a time Protestantism had made Biblical knowledge much more widespread. This meaning survived until at least the nineteenth century, but it gradually merged with another usage.
In German, Philister was a derogatory term for a townsperson/a non-student among German students. It's been reported that this goes back all the way to the seventeenth century, "The Philistines pejorated their bad name at a town and gown row at Jena in 1693." The German word came into English directly, for example, Thomas Carlyle wrote in 1831
Mr. Taylor is simply what they [sc. Germans] call a Philister; every fibre of him is Philistine.
The English writer Sir Arthur Helps similarly wrote in an 1859 essay:
If there were a stupid man amongst us, or what the Germans call a Philister.
Though the word "Philister" also appears in an Edinburgh magazine in 1856 without direct reference to Germany:
t counts as nothing that a man has been a student once; let him take a certain step in life—for instance, a government office—and back he goes to the Philisters again.
The usage of the German word fell completely out of fashion, eventually, and the English word, which had a longer history, prevailed in this sense of "non-student". For example, future British Prime Minister wrote in his 1824 A Tour of Germany:
The mere citizens, or Philistines, as they are denominated by the sons of the academic Israel, form a despised and rejected race.
As a non-student it seems to have mostly been used in direct reference to Germany, as in this quote from Yale Literature Magazine in 1853:
The genus by the German students denominated ‘Philistines’, by the Cantabs ignominiously called ‘Snobs’, and which custom here has named ‘Townies’.
From there, foe and non-student combined to mean, "An uneducated or unenlightened person; one perceived to be indifferent or hostile to art or culture, or whose interests and tastes are commonplace or material; a person who is not a connoisseur." This usage was still often associated with Germany, for example a London Newspaper wrote in 1827,
If Germans require that species of assistance, the obtuseness of a mere English Philistine we trust is pardonable.
and an address at Dartmouth College claimed:
Released from the importunity of this Philistine [sc. Wagner],—to use an expressive German term,—Faust relapses into his former gloom.
In 1879, the literary critic Leslie Stephen writes,
In common phraseology he [sc. Macaulay] is a Philistine—a word which I understand properly to mean indifference to the higher intellectual interests.
He indicates that this is a relatively common word, but it's worth noting that it's still uncommon enough that he has to make explicit the sense in which he's using it. So ultimately, here is where you get your answer to roughly when; why should already have been covered by the converging of the sense of foe and non-student, both of which are figurative allusion to the Philistines of the Hebrew Bible.
That's all pieced together from the information in the OED. Etymonline gets you there quicker, and just says:
"person deficient in liberal culture," 1827, originally in Carlyle, popularized by him and Matthew Arnold, from German Philister "enemy of God's word," literally "Philistine," inhabitants of a Biblical land, neighbors (and enemies) of Israel (see Philistine). Popularized in German student slang (supposedly first in Jena, late 17c.) as a contemptuous term for "townies," and hence, by extension, "any uncultured person." Philistine had been used in a humorous figurative sense of "the enemy" in English from c.1600.