It is considered an odd story even by Christian academics.
What makes it problematic are the following points:
1. Though that specific area was inhabited by Gentiles, archeology has never uncovered any pig bones from there. There is no evidence of pig herding from Galilee of the first century.
2. Pigs can swim. In fact, they are notably excellent swimmers, even if they jump from high distances into water.
The story therefore might be written with some hyperbole or allegory. This is noted in the Jewish Annotated New Testament. The expression of Jesus in Matthew 8, especially the single word "Go" to exorcise matches an older Jewish tale of the famous rabbi exorcist Shimon ben Yohai. It may have been modeled on this to teach some sort of lesson now lost to modern readers.