To me it is as good as asking, Why God created human beings and some are theifs and police? Good things and bad things? God has created everything for a purpose, it is human beings who follow the wrong path..
to my knowledge it was created to do the scavenging works ,to eat filthy things.,it is not necessarily be eaten just because God created something.then why don't u eat poisonous plants either,coz even they were created by God, right.It's a test to see who will and who won't. If God didn't put "bad" stuff on Earth, what would He test us against?
Now can I ask u a small counter Question? Why God has created Cattle if that not to be slaughtered and eaten?