I want to put a new Sram X7 instead of killed one, should I open the chain (if I have no chain lock) or it's better to open the derailleur?
It's much better to open the chain. Derailleurs are not really designed to be opened repeatedly, and doing so inexpertly can potentially ruin the derailleur. Chains might have either a lock link or a master link of some kind, find that open the chain and then thread the chain through the derailleur. If the chain does not have one of these links, you will need a chain tool to split the chain. DIY grade ones are quite cheap and do the job well, but you will need to read up on how to use it properly.
Also consider that if the size of the derailleur arm is different, your chain may need either fewer links or more links to fit properly.