Sample rate is the number of times per second that the level of a waveform is measured when analog audio is converted to digital. It is expressed in Hz or kHz, so 44.1 kHz means 44,100 samples are taken every second. It sets the resolution along the time axis, a different role from bit depth, which sets the resolution of amplitude.
Relationship to the frequencies you can capture
In theory you need a sample rate higher than twice the highest frequency you want to record. 44.1 kHz and 48 kHz are widely used for music covering the audible range because, on top of that relationship, they leave room for the filtering involved in conversion.
44.1 kHz and 48 kHz
44.1 kHz is common for music distribution and CD-derived production, while 48 kHz is common for video and film work. Even so, the right value depends on the delivery specification, the gear you use, and your source material. When the final use is already decided, matching that specification from the start of the project reduces conversions.
Higher is not always better
High settings such as 96 kHz can handle higher frequencies, but file size, disk throughput, and CPU load all increase as well. Your plugins and audio interface also have to support it. Sound quality is not decided by the number alone.
Keep it consistent within a project
When your material and your project use different sample rates, the DAW performs sample rate conversion. If a file is played back at the wrong rate without conversion, its speed and pitch change. Rather than changing the project setting after recording, decide at the start and convert differing material after checking the quality.
It also affects latency
At the same buffer size, a higher sample rate means each buffer covers less time. On the other hand, more samples have to be processed, so CPU load rises. When recording, adjust within a range that avoids dropouts. Specific steps for changing this in Logic Pro are explained in How to change bit depth and sample rate (Japanese).
