Note: this is a "vintage" tip for older computers/systems.
From any program command space sets the language to the next script and command option space sets the language to the next language in the current script. If you find the language changing unexpectedly check the software you use (eg Photoshop) doesn't also use these combinations.
Remove associated resources if you don't need them to stop this happening accidentally. Open the system file and remove the unwanted keyboard "files". (Standard warnings for modifying the system apply).