In Cub Scouts, the whole group of youth in grades K-5 plus adult leaders is called the "Pack." For most activities however, the youth work in grade level groups called dens. Each den can have as many members as its adult leaders allow, but the recommended size for a den is 3-8 youth plus an adult den leader and 1 or 2 assistant den leaders.
Each Den has its own number which remains their Den number throughout their time in the Pack. The den number is part of Cub Scouts Class A uniform insignia (patches on their shirt). A Cub Scout's rank (Lion -> Tiger -> Wolf -> Bear -> Webelos) will change each year but their den will not (unless a den is split later on to form smaller groups).
Dens are organized first by grade level. Dens are formed when there are adult leaders (usually parents of youth in the proposed den) willing to be trained and serve as organizers for the group, at which time the den is assigned a number by pack leaders. Most dens come together in the first grade (the Tiger year), but a new den can form any year. Once a den is established, it remains until its youth members end their time as Cub Scouts (in spring of 5th grade).
In Cub Scouts, a rank represents a level of achievement tied to a child’s grade in school. Each rank—Lion (Kindergarten), Tiger (1st grade), Wolf (2nd grade), Bear (3rd grade), Webelos (4th grade), and Arrow of Light (5th grade)—introduces age-appropriate adventures that build skills in the outdoors, fitness, citizenship, safety, and character. As Scouts complete these adventures, they earn badges and move up through the ranks, preparing for the next stage of Scouting in Scouts BSA.
For a full overview of Cub Scout ranks and the adventures required at each grade level, you can view the official Cub Scouts Insignia and Advancement Chart provided by the BSA: Cub Scouts Insignia Chart (PDF).