Eck and Hoffmann were executed because in their roles as the boat's senior officers, responsibility for the actions of their crew, as well as their own, fell directly on their shoulders.
Eck and Hoffmann were executed because, as the boat's senior officers, they bore full responsibility for both their crew's actions and their own.