Yes, look in the case. If you received the game new, there should be a valid GOG code either on the back of the manual, or on a paper insert, depending on the edition. You can redeem the code here: https://www.gog.com/redeem
If you received the game used, however, there's a chance someone may already have entered the code. In this case, you'd have to ask the person who gave you the game.