My question is if eating pork is forbidden in Islam unlike beef then why Allah created it at first place?

We cannot explain why Allah created certain things or animals. It could be as a test for us. Everything from Him has a purpose and nothing is in vain.