People might watch or read Dragon Ball and ask the question "Why is so Gotenks so cocky?", especially considering the serious context of the Buu saga and when he was in charge of putting an end to the titular villain. However, this fusion between Goten and Trunks is the end result of their personalities and also their genetics as half-Saiyans.
Gotenks is cocky because he is the fusion between two kids who don't know how to take things seriously and this is exaggerated even further when considering the Saiyan nature in Dragon Ball since they tend to get arrogant when getting the upper hand.
This is what resulted in the characters' doom when facing Majin Buu, and the main reason why Goku didn't add Goten and Trunks for the Tournament of Power arc in Super.
Disclaimer: This article contains spoilers from the manga/anime and reflects the opinions of the writer.
Saiyans' natural demeanor in Dragon Ball, explained

A prevailing element regarding Saiyans, and this is something that both Goten and Trunks have when they turn into Gotenks, is that they can get quite arrogant when they have the upper hand.
Both Goku and Vegeta, two pure-blooded Saiyans, tend to do this quite often throughout the series, oftentimes making divisive decisions just to satisfy their desire for fighting.
Perhaps two major examples regarding Goku involve sparing Vegeta's life after their first fight in the Saiyan saga, so they could fight again, or giving Cell a Senzu so he would be in top condition before fighting Gohan, since he thought his son could be the monster.
Vegeta himself allowed Cell to reach his Perfect Form for a challenge and also became a Majin in the Buu saga to force a fight with the protagonist, leading to a lot of disastrous results.
Moreover, this was reflected in their sons, with Gohan getting the upper hand against both Cell and Super Buu, and resulting in those villains having a chance to recover, leading to several casualties.
Therefore, it is not difficult to understand why Gotenks would have a similar behavior when considering that he is the fusion of Goku and Vegeta's sons.
How fusion is shown to enhance these natural traits

Another factor to answer the question "Why is Gotenks so cocky?" is because he is the fusion of kids in Dragon Ball, so their childish traits were going to be quite prevalent in his characters.
This is further emphasized during the battle with Super Buu thanks to his comical attacks and even the fact that he kept hiding Super Saiyan 3 for greater dramatic purposes.
It is also worth pointing out that Goten was always quite lighthearted and relaxed and Trunks was always a bit arrogant and mischievous, so it makes a lot of sense that their fusion would have a lot of these traits.
That is why they agreed to fight Super Buu when Gohan had the upper hand, leading to them getting absorbed, which caused a lot of problems in the long run.
Final thoughts
The answer to the question "Why is Gotenks so cocky?" boils down to the Saiyans' nature in Dragon Ball when they get the upper hand and also both Goten and Trunks' childish tendencies since they are kids.
It makes a lot of sense that this character tends to take things in a very lighthearted manner when considering the context of his creation.
Related articles:
- Dragon Ball Super fans torn over Toyotaro's next volume cover looking "like terrible fanart"
- Dragon Ball Super fans agree they're "so lucky to have" Toyotaro after his latest Toriyama tribute
- Dragon Ball fandom split as Toyotaro's latest comments send series' powerscaling "down the drain"
- Dragon Ball Super fans demand Toei “BRING THE ANIME BACK” after English preview of Ultra Ego Vegeta’s iconic line