From what I was tought, 생선 refers to any fish that will be consumed as food -- whether dead or alive. So if you see fish in a river and you plan on eating those very fish, you can refer to them as 생선. Likewise, if you go to a Korean fish market (where most of the fish are still alive), those fish are all also 생선. And then the cooked up fish on your plate is also 생선.
In the same vein, 물고기 is any fish that will not be consumed. So, your pet fish is a 물고기. The fish you plan to go fishing for and then release is also 물고기. But so is a dead fish you find washed up ashore (assuming you won't be eating said dead fish).
what if you didnt plan to eat the fish and you were saving the fish as pet but your cat ate it so you tell the cat in korean "why did you eat my fish??". would you tell the cat 생선 or 물고기? u got mad at the cat with the intention to tell it off by letting it know it was supposed to be a pet fish. the fish in case what would it be?