Decompilers are not illegal. It's just a particular way to do reverse-engineering. The only way you could be not allowed to do it is if you signed a EULA saying you will never reverse-engineer or decompile the software in question - an unjust provision which is unfortunately common.
I haven't studied Game Maker's EULA, so I don't know whether it's "no reverse-engineering" provision applies to people's games made with Game Maker. I feel like it probably does.
Regardless, decompiling does not show how a game is made. It only shows you code (usually in Assembly) that could
have been used to produce the given binary. If you want to see how games are made, look at the source code of libre games. Like mine!
This site catalogs most of the notable ones:https://libregamewiki.org