The goal of sprint planning is to determine the most important subset of ready product backlog items to build in the next sprint. During sprint planning the Scrum team agrees on a goal for the sprint, and the development team determines the specific product backlog items that are aligned with that goal and that it can realistically deliver by the end of the sprint.
The figure below, from the Visual AGILExicon®, illustrates the sprint planning process.
The sprint backlog is a tool designed to help the development team to acquire confidence in what it can deliver. Although not technically required by Scrum, many development teams plan for how they will deliver the items in the sprint by breaking down each targeted feature (shown as blue bricks in the picture) into a set of tasks (shown as green cubes). The collection of these product backlog items and their associated tasks makes up a typical sprint backlog.
The team then compares the sprint backlog against its predicted available capacity (measured in effort hours) to determine if the amount of work it has chosen is realistic. Some teams prefer to measure capacity in terms of story points (historical velocity). Keep in mind, that a team’s capacity for any given sprint should take into account planned time off, product backlog grooming, any training or work on other projects, and so on. Don't forget to leave a reasonable buffer to address uncertainties.
The sum of the task effort hours in the sprint backlog can then be compared againt the teams available capacity to see if the team has enough confidence to commit to the selected product backlog items.
The sprint backlog is just one tool that the development team might use to acquire confidence that it can complete the selected product backlog items. A development team is permitted to use any means at its disposal to acquire such confidence.
By the way, the sprint planning image shown above is part of the Visual AGILExicon® that I created for my classroom presentations and to use in my Essential Scrum book. At no cost you can get hi-res copies of this picture and all of the other pictures in the Visual AGILExicon. For more on sprint planning and how the sprint backlog is used, see Chapter 19 of Essential Scrum.