Step 1: Head over to GOG.com. Sign in or create a new account.
Step 2: Once logged in, select "redeem code" from your profile menu or simply visit the following link gog.com/redeem.
Step 3: Enter the cd key that you would like to activate on GOG and press "continue".
You can also redeem your GOG.com code using GOG Galaxy client. Download the application using this link. The option you're looking for is located in the top-left corner. Click on the "settings" icon, then choose "Add games & friends" followed by "Redeem GOG.com code".