As we know as of Chapter 4, the only people who know the code of the Bunker are Carol, Dess, Undyne, and Asgore. As the mayor and police chiefs this makes sense, and Dess knowing isn't outside the realm of possibility either. We also know that there's a Dark Fountain inside the bunker which we can presume has been open as far back as Chapter 1, if not earlier.
Based on Asgore's secret dialogue in the Holiday manor, we also know he's in the know about Dark Fountains (which knowing the code to the Bunker would probably warrant), given the dark shard in his possesion. Asgore is also trying to clear his name which he believes in doing so would also fix his marriage, this motivation also being related to his discharge as police chief. This means that Asgore must've done something controversial as a police chief, something so bad it wrecked his marriage and got him fired. But it also has to be something that he can't fully explain, something like the Bunker Fountain.
All this too say, this is what I think might've happened (which will probably be debunked the time Chapter 5 rolls out):
Being the mayors daughter, Dess was able to discover the code to the Bunker, and after writing the code down in her guitar, she decided to enter, not knowing about the Dark Fountain. Asgore would've gotten an alert there was activity in the Bunker, and in order to keep whatever was inside contained (maybe a Titan) he closed the doors, locking Dess inside in the process. This could've created a scandal big enough for Asgore to leave the force, while keeping a level of uncertainty that stopped him from becoming a town pariah.
Asgore has been trying to fix this ever since, which led him to encounter (or alternativley, seek out) the Knight; who alike Jevil, Spamton and Gerson, gave him a monkeys-paw solution. Chapter 5 would then be about Asgore inacting this plan to clear his name, resulting in more harm than good.