Humans are not perfect. That's why.
When a hack happens usually people think that the blockchain technology is not secure. It is not true. The blockchain technology is one of the most secure technologies available. Even so, the reason why hackers manage to penetrate into different system is mostly because of commonly known "human mistake". What does it mean? Well, for example, somebody forgot to test a functionality before publishing it, or somebody forgot to close a vault before enabling trading on a platform or they have used hot wallets instead of cold ones. If you do a little research you will find out that these kind of human mistakes are everywhere.