The events of Doomsday Machine are pretty well known...
The Constellation followed a path of destroyed solar systems until they came across the fourth planet in system L-374 breaking up. The Constellation was unable to reach Starfleet or (as far as they knew) any other starship.
When they approach the planet to investigate, the Planet Killer attacked them (it is designed to automatically attack in power source that falls within a certain range). With most main systems down and the Planet Killer continuing to attack, Decker orders his crew to abandon the ship. While about to beam himself down to join his crew, the final attack by the Planet Killer knocks out the remaining systems of the Constellation stranding him there.
Decker assumed that with the Constellation helpless, he was about to die. But the programming of the Planet Killer made it disregard the Constellation once it no longer posed a threat. So instead it moved in on the third planet to refuel.
Decker, alone on the helpless Constellation, watches and listens as the third planet is destroyed and his crew killed.
When the Enterprise arrived on the scene, they (like the Constellation before them) didn't see the Planet Killer at first. And even after listening to the log entries of the Constellation, the Enterprise stayed on site after the Planet Killer approach them, and then attacked them just like had happened to the Constellation.
It was only after studying the Planet Killer's reactions both to the powerless Constellation and the Enterprise once outside of a safe distance that Spock determined that the Planet Killer must be programmed to attack any energy source within a certain range of it. Additionally, after looking at all the data, Spock determine that the Planet Killer would head to the Rigel system next.
There would be no way to warn the Rigel system (which has billions of inhabitance) about the attack before it happens, nor would there be any way to alert Starfleet to send ships before the attack. Decker decides that the Enterprise must stop the Planet Killer there before it reaches Rigel.
Now, if Decker is guilty of anything, it has to be the mistake of attempting to attack the Planet Killer in the same way with the Enterprise as he had with the Constellation. It wasn't until relieved of command that he was willing to try something new and different.
Frankly, blaming Decker for his actions and the deaths of his crew is like blaming the passengers who rushed the cockpit of Flight 93 for the death of the other passengers. It was Decker's actions and refusal to give up that saved billions in the Rigel system, even at the cost of his crew, his own life and finally the Constellation herself.