First, consider running a Session Zero. You don't have to give away your plans, but two general topics of discussion would be character death and railroad vs. sandbox. I'll come back to these.
- Lack of player agency.
- Perceived unfairness.
- Players believe death "isn't real" and won't take it seriously in the future.
- Characters learn that opponent is dangerous, and players learn that some opponents can't be beaten without proper preparation.
- Cathartic release of realizing they're "not dead yet".
The GM's roll is chief storyteller. Stories can involve setbacks. Of course, in a game, setbacks can be discouraging. But in stories, accomplishments that come after setbacks are the exciting ones. In the Marvel Cinematic Universe, if the heroes defeat Thanos at the end of Infinity War, that could be a very enjoyable story, but it is also a very different story, and it removes the pathos and triumph of Endgame. Whether one is better than the other is debatable, but as a GM asking players to commit months or perhaps years of play to a campaign, you should get a sense of what they would be happy with. Players should also realize that they won't all want the same thing. If two-thirds of your players want character death to be a real threat and one-third don't, the one-third that don't are going to have to choose whether to go along with it or find another group.
The lack of player agency is tricky, and one thing to discuss in Session Zero is the railroad vs. sandbox approach. Realizing that this is a continuum, and few adventures fall at the extremes, there is a tradeoff between storytelling potential. In a sandbox, players may have more agency, but a series of disconnected vignettes may not be very satisfying. A railroad gives the story the most structure at the cost of play agency, and at some point they may just prefer to watch a movie.
You ask about risks, but I do see upsides to this opening, the most important being learning that some threats are insurmountable, and will require planning and preparation to pull off successfully. Again, this is a question of what the players will enjoy that should be addressed in a Session Zero. You could throw 1st level characters up against an ancient dragon. If this comes without warning, it would be grotesquely unfair. But if you give the characters a way to find out how serious the threat is and avoid the encounter, or to beg or bribe their way out of a TPK, that could be a very enjoyable experience for the players.
How to Mitigate the Risks
There is no specific reason why your story is a bad story. It may not appeal to all players, but some will enjoy it immensely. There are several ways you can handle this, but again, do start with a Session Zero where you discuss some of the issues, while avoiding spoilers.
Skip the session and just go straight to the afterlife
Getting the story going is always hard, and you've described a very generic opening (sitting in a tavern, "Oh won't someone help us, etc.") that from your own description even you don't find all that exciting. Why not skip it? The characters open their eyes and are being questioned by a demon. Memories start to come back to them. You could provide memory fragments to the players ahead of time--everything up to just prior to the BBEG. Then you could narrate the confrontation and the characters' demise.
Tell the Story In Media Res
Begin as above with the characters waking up in the afterlife. Then, instead of having them remember what happened, have them play through the adventure, knowing that it will lead to their doom.
As an alternative, you could have them wake up in the afterlife, have them remember (not play through) most of the events leading up to finding the BBEG, then give them a choice--do you want to fight a losing battle to see how powerful your opponent is, or do you want me to just narrate it for you? Some players may very well choose to play through it, even knowing it is a foregone conclusion.
Don't Wait for the Reveal
If your Session Zero indicates your players are fine with dying, and don't mind occasional railroading in the interest of storytelling, you could play it the way you've described, leading to the TPK. However (a) don't let the fight drag out, and (b) have them wake up in the afterlife immediately. A BBEG may have multiattack or legendary actions, and any one of their actions may very easily kill a low-level character. This fight could end in one round. Don't drag it out. And then, don't let the session end and wait for the next session for the big reveal (even if MCU could let a year pass between Infinity War and Endgame). Have them open their eyes in the afterlife and take if from there.