The most likely rationale I can come up with is some guy who never actually fought in a battle in his life thought it would look cool.
Have you ever tried swinging a woodcutting axe (or a pickaxe, or a mattock, or something similar)? It takes a huge amount of effort to actually use it, requires special application of leverage, and even then is far too slow to be an effective weapon against anything that's realistically agile. On top of that, if swinging for an attack and you miss, it takes far too long to recover from the miss and get to a guard stance, let alone prepare for another swing. The only reason this stuff is viable against zombies in so many movies, TV shows, comics, and other stuff is because zombies are really slow, and tend not to dodge.
Real world battle axes were relatively lightweight affairs. They would be used against hide or leather armor, not plate armor, and definitely not stuff like chain mail or scale mail (the whole point of chain mail is to make you hard to cut). That's part of the reason that a lot of historical portrayals of combat show axes used by raiders, brigands, and other people who are most likely attacking unarmored or lightly armored targets. Some long ones were occasionally used by cavalry, but mostly just to gut the other guy's horse or to lop off the unprotected heads of infantry as you ride past them.
Now, using one for a bayonet or a hybrid weapon has other issues...
The reason that a spear-like bayonet works as well as it does (which is honestly not quite as good as a real spear) is because of how it ends up being used. Because almost all of the force is (usually) applied along the long axis of the gun's barrel, it's very easy to design a reasonably reliable locking mechanism to keep the bayonet attached as you stab someone without damaging the gun in the process (most of the time).
A large part of the reason that in real life axe-bayonets (they do exist, see some of the other answers) have been unpopular is because they can't be made this way. Striking with the axe inherently applies force in a way that makes it very easy to damage the gun, or at least severely impact it's accuracy long-term. They're also very heavy compared to spear bayonets (a spear bayonet can just be a long spike, no need for a cutting edge or any extra material to reinforce it heavily or provide a counterbalance), which makes it harder to use the gun as a gun.
Something to keep in mind though is that bayonets were never intended to be a 'primary' weapon. Most people who used guns back in the middle ages (and even up until the end of WWII in some cases like the Imperial Japanese Army) carried a sword of some sort as a sidearm, with the being a stop-gap for when they were caught by surprise and couldn't drop their gun and draw their sword. Bayonets suck for actual combat. They're better than nothing, but honestly not by much, especially if you don't have a long (in the conventional sense of the term long) gun to put them on. The only reason they became the standard in late medieval and early modern Europe is logistics. Musketeers with bayonets replaced the roughly 50/50 mix of musketeers and pikemen that was used previously because a bayonet on a long musket works almost as well as a pike, and that way you didn't lose out on firepower just to protect your musketeers from cavalry attacks (and you had one less type of weapon to worry about supplying your soldiers).