VirtualProtect changes the access permissions to a memory region. While some areas are writeable without any change (e.g. data-structures), some are forbidden to write (executeable code!).
In case you want to change something in such region, you need to change the access permissions by using VirtualProtect, or the write access will fail on an access violation.
You can also allocate memory and define it as executable. I've seen autoit malware doing this for hiding
problematic code. In other native languages, this is a common technique in runtime packers for unpacking the binary payload.
In general, cheats and gamehacks use PAGE_EXECUTE_READWRITE to simply gain all access rights when they need to change executable code.
See:
The same goes for
OpenProcess. If you know what you want to do, you can choose
lesser permissions, but in general, just take any permission you can get and you are good.