Legality varies by country; in the EU and US, circumventing DRM on industrial equipment may violate copyright law if the OEM still exists.
For the series (now discontinued), official password recovery options are very limited because Siemens prioritizes security. Here’s what you can try: Siemens S7-200 Password Unlock