A carrier-locked phone (also called network-locked or SIM-locked) can only be used with SIM cards from one specific mobile network. For example, a phone locked to AT&T will reject SIM cards from T-Mobile or Verizon.
Carriers often sell phones at a subsidized price in exchange for a contract. The lock ensures you stay on their network for the contract period. Once the contract ends or the device is paid off, the carrier may provide an unlock upon request.
Always check both statuses before buying a used phone.