Apple sells locked devices to the carriers and the carriers decide themselves when to unlock them. Apple knows for each device if it is locked or not and to what carrier, but as this decision belongs to the carriers, Apple won't tell you.
So if you bought a locked iPhone somewhere and now need to activate it with the original SIM card or want to ask the original carrier for an official unlock, you need to know what carrier it is.
Because Apple won't tell you, the only way is to try to find out the carrier by looking at the model number. This gives you the region or country. With this information you can ask all carriers in that country if it is their iPhone.
What country does my device belong to?
It is not possible to tell the exact provider just by the model number. Locked and unlocked models share the same model codes. As Apple doesn't provide this information (with serial or IMEI number or whatever), there is no way to find it out. Not even if you pay anything to a company that seems to offer this.