How to Play Sonic Gems Collection on Dolphin Emulator - A Guide for Sonic Fans
As for the game itself, due to legal reasons, we cannot help you there. Technically, if you own the physical version of Sonic Gems Collection for either PlayStation 2 or GameCube that you have paid for, you can legally download the backup ISO from wherever you can find it yourself and use it with the mentioned emulators.
I am very into my movies, and have bought massive collections on VHS, Laser Disc (very expensive), DVD, and currently Blu-ray/4K Blu-ray, I would shudder to think of the amount of money I have spent on these various formats over the years...I have also downloaded some pretty awesome movie torrents, and the quality is superb, so pirates are not always purely downloading everything for free.....