... now the SIM seems to be locked.
What makes you say this?
What exactly is happening?
iPhone's don't normally just lock to a carrier for no reason. If it is locked, something had to happen for it to get locked, and it would be hard to imagine it getting locked to the original carrier if it has not been used with it.
The only way this could have happened was if the iPhone was unlocked by hacking it or other unsupported means, and then was updated or restored. These side-unlocks will get undone when you update or restore the iPhone.
Otherwise, its more probable it got locked to whatever carrier you were using before. Contact them first and see if its locked to them.
Is there any way to know who the original network provider was?
Only Apple can find this out. Nobody else can, and neither can those services online that purport to be able to do so.
click here ➜ Contact Apple Support to Identify the iPhone carrier