I can understand that if you obtain the source code for a game (for example, if you cloned it from GitHub), then you could edit the code yourself, and have a working copy of the original game with your edits incorporated (a 'mod').
But I'm not sure how mods can exist for games whose code isn't publicly available. How is it possible?