Doc has it right. There were match locks before we had Wheellocks, then flintlocks, then Percussion locks.
When early metalworking began to go beyond simple edged tools, and mechanical devices evolved where two pieces of metal had to hold together, move together, and release one or both parts, the first work was for security and involved replacing wooded door locks, with metal ones. One of the first specialties in the Blacksmithing trade was making locks. Locksmiths used files far more than any blacksmith would to shape metal to size and fit. The Blacksmith used his hammer instead. The Blacksmith MADE the files for the locksmith, but the locksmith spent his days filing and shaping metal parts to do complex work.
That Matchlock was the simplest mechanism, involving the hammer, or cock, that simply held the wick, a tumbler with a sear, moved by a simple V-spring, and the trigger bar. The Wheel lock came directly from the Lockmaker's other source of revenue, which was clocks. They had figured out how to make coiled springs, instead of V-springs. Like an old hand wound alarm clock, coil springs needed to be wound up or " loaded ", and a Key, or spanner, was used to do this. Again, the mechanism was called a " Lock " because of the specialized skills needed to design and make it. This was not something made by a blacksmith at his forge and anvil. It was made by a locksmith. Later, clockmakers would spin off as a separate discipline of lockmaking. If you possess a " Bic " butane lighter in your survival kit, you possess the latest incarnation of a " Wheel lock ".
The term, "Lock ", hardly suggests its origin only because you are dealing with a technology that has been around for 500 years, and our language has evolved, expanded, and to some extent changed over that time.It is almost as impossible to fathom that a BlackSmith was the only source of all tools to whole towns and villages, while tinsmiths, and coopersmiths traveled from town to town, selling their pots and pans, and making repairs. Today, A Farrier, who shoes horses exclusively, is the remaining subset of Blacksmith specialty work. Within Blacksmithing, there are smiths who specialize in doing certain kinds of work, but all are called blacksmiths, because they basically use the same equipment, and same techniques, whether making a knife, or an ornate flowered Iron Gate for someone's home.