The heptagon has seven sides. There are a lot of people who like polygons in general because they find the shapes of the different polygons appealing. There are a lot of adults who have already forgotten the names of the various polygons depending on their sides.
A lot of people remember the octagon because this is the easiest one to remember, and a lot of teachers used this as their typical example before. Some kids will know the names of each pentagon shown to them because the lessons are still fresh in their minds. Adults would need to think before answering, but most kids would blurt out the answers.
You can take a look at the illustration and see that the answer is seven. The heptagon has seven sides. There are a lot of people who are fascinated with the heptagon, octagon, nonagon, and so much more. They make it a point to memorize the names of the different shapes. Some become a bit extra and choose their favorite shape based on the number that they like best.
It is true though those kids may know this detail more as compared to adults. Adults usually do not need to use this information when they do work unless it is related to their industry. You can ask a kid about this and you will get the right answer. Ask an adult and the answer you get may not always be correct.