There are two possible reasons why the law was given distinguishing between clean and unclean animals:
(1) The main reason, because it is the one explicitly stated in the Bible was that the people were to “not defile themselves”, the physical defilement apparently emblematic of spiritual defilement.
Leviticus 11:43-44 Do not make yourselves detestable by any of the swarming things.42 You must not defile yourselves by them and become unclean by them, (44) for I am the LORD your God and you are to sanctify yourselves and be holy because I am holy. You must not defile yourselves by any of the swarming things that creep on the ground,
The details of some of the forbidden animals hint at spiritual lessons applicable in all ages. The details of how an animal walked and how it ate suggest that how we walk spiritually, and the things that we consume are like the thoughts that enter our minds.
This principle was extended when Peter was given divine instruction allowing non-Jews to be accepted as Christians:
Acts 10:10-15 And he became hungry and wanted something to eat, but while they were preparing it, he fell into a trance (11) and saw the heavens opened and something like a great sheet descending, being let down by its four corners upon the earth. (12) In it were all kinds of animals and reptiles and birds of the air. (13) And there came a voice to him: “Rise, Peter; kill and eat.” (14) But Peter said, “By no means, Lord; for I have never eaten anything that is common or unclean.” (15) And the voice came to him again a second time, “What God has made clean, do not call common.”
(2) There are practical health reasons for some of the banned animal foods that would have benefited Israel, if they kept those laws. For example if meat from pigs is not carefully managed then serious harm can be caused to human health. This is not the reason stated in Scripture, but was a real benefit. However it is a mistake to suppose that all possible health rules that could have been devised were included in the law given by Moses. For example, poisonous plants were not mentioned. God has provided plants as food. Self-evidently God does not expect us to eat poison. Nor is there any reason to suppose that God should have given comprehensive instructions on which plants were poisonous.