This setting adjusts how long it takes for the screen on your device to turn off automatically, if it has not been used for a while.
Because having the screen off saves a lot of battery power, it's good to turn off the screen while you're not using the device. This setting controls how long it takes for the screen to turn off automatically if you haven't interacted with the device for a while.
Certain apps can override the auto sleep mechanism. For example, apps for viewing videos will usually force the screen to remain on while the video plays regardless of this setting.
In addition to being able to set the sleep time in minutes, some devices have various "automatic" settings for this feature. For instance, some devices have a feature that detect, through the front camera of the device, whether you are still looking at the screen. If it thinks your eyes are still looking at the screen, it will keep the screen on. This feature uses some additional battery by using the front camera. Other devices may have an "auto sleep" feature whereby the amount of time it takes to turn the screen off depends on whether the device is sitting horizontal, such as on a table, or if it is held at an angle, as if it's being held in the hand. This tends to use less battery power but be less effective.