You would have to try different SIM cards until you found the one that worked. A second hand store or pawn shop that sells phones may have a collection of SIM cards from various carriers. If they agree, you could test different SIM cards.
First, restore the iPhone then insert a SIM card. If the iPhone activated, you’ve discovered which carrier it’s locked to.
If you have a variety of carrier stores in your area you could ask them to try one of their SIM cards.
BTW, how do you know it’s locked? The only way to find out is to restore the iPhone and activate it with a SIM card. If it doesn’t activate with a SIM card inserted, it’s locked to another carrier.