Depending on the type of lock, a locksmith may be able to first pick the lock (open it without the key), and then make a new key to fit. This is likely to cost approximately as much as a new lock, however, so best ask about cost before leaving the lock with the locksmith. It's almost certain to be cost effective, however, if you can pick the lock yourself and make the new key yourself. There are many YouTube videos on how to do this, and neither task is especially difficult, even with improvised tools (I picked my first lock in under ten minutes, with a bent paper clip and small screwdriver).
Of course, this more or less assumes it's a conventional single-bitted pin- or disc-tumbler lock. If it's a more sophisticated type (double-bitted, barrel key, magnetic, or other complex type), it may be very difficult even to pick, never mind to fabricate a key. If that's the case, you're ahead to cut the lock or cable off the bike (an abrasive wheel on a rotary tool or angle grinder works better than any other method I've tried), and get a new lock (as well as a duplicate key to keep in a safe place at home).
Even if the latter case is the only way out, if you're interested in such things you might keep the lock mechanism itself to learn from.