Recording audio for this kind of use is called sampling, and an instrument that can record and play samples is a called a sampler. There are software and hardware samplers. A sampler that cannot actually record is (sometimes) called a playback sampler or sample player, to distinguish them from "real" samplers. https://en.wikipedia.org/wiki/Sampler_(musical_instrument)
You can either do the sampling with a stand-alone sampler that can actually sample, or record the audio in a DAW (or audio editor) and then import (perhaps drag&drop) the recorded clips into a sample player such as Kontakt or HALion. You'll have to slice, trim, level, clean, name, tune, sort, group, pitch-map, velocity-map, note-map, maybe loop the samples somewhere, with or without the help of automated tools. Search for "sampler that can actually sample" and you'll find some product alternatives. Some DAW applications come bundled with a sampler plugin, and even if the plugin itself cannot actually sample, you can see the integrated DAW + plugin combo as a full sampler.
Some samplers make creating sample programs easier than others, for example by auto-thresholding/slicing start/stop locations and auto-detecting and mapping pitches, so you don't have to manually spoon-feed every small detail for the sampler. Depending on the instrument and the level of authenticity you're after, even a few separate samples can be enough, particularly if the listeners aren't familiar with the instrument's sound. But for some instruments, a well-made sample program can have thousands of separate samples.
Using the actual sampler software might not be the only thing to learn. The physical act of recording, mics, mic placement, room acoustics etc. is important as well, and those things aren't trivially easy to handle. Background noise can be somewhat of an issue for polyphonic instruments. Every recording has some background noise, and if you record a whole performance, you get the noise "once", but if you record individual notes and play back, say, 10 such recordings simultaneously, you're playing 10 copies of the background noise. But you'll learn these things as you go.