In order to discuss insects in fish, we need a bit of introduction.
The Torah forbids eating insects. However, it only forbids insects which “creep upon the ground.” If the insect never did “creep upon the ground,” it is permitted.
However, even if an insect did not literally creep “upon the ground,” but was born in a fruit or vegetable while that fruit or vegetable was growing―the insect is still considered to have been “on the ground,” since the item which it inhabited was “on the ground.”
If, however, an insect had never been alive on the ground nor inhabited a fruit or vegetable which was growing on the ground―it is permissible. Consequently, if an insect was born in a fruit that was already separated from the tree―that insect is permissible.
If that insect was removed from the fruit or vegetable it inhabited―it becomes an insect that “creeps upon the ground,” and is prohibited. This applies, whether or not it was alive when it was removed from the fruit or vegetable.
With this in mind, we can discuss insects in fish.
Insects that are found on the outside of a fish are prohibited, since they are assumed to have come from the outside. Since those insects were, at one time, “insects which creep upon the ground,” they are prohibited.
By the same token, insects that are found in the intestines of a fish are prohibited, since they are assumed to have been swallowed, and to have come from the outside
On the other hand, insects that are found within the flesh of a fish, or between the skin and the flesh, are assumed to have been born inside the fish―and are permitted
Is it not possible that an insect could have come from the outside, been swallowed by a fish and gone into the intestines of a fish―then migrated to the flesh of the fish? No. The insect cannot penetrate the intestines and travel through to the flesh.
However, if one purchased (or caught) a whole fish, and, in “cleaning” that fish mistakenly punctured the intestine―there could be an issue, since the worms may have been born outside the fish, may have entered the intestines, and may have gone into the flesh