A software wallet consists of an application that you run on a computer or phone. These wallets are less safe than hardware wallets because their so-called "attack surface" is larger than that of a hardware wallet. This is because a software wallet is often or always online (hot wallet) and a hardware wallet is only online for a short amount of time or ideally never online at all (cold wallet).
Besides your software wallet, a computer or phone also runs a lot of other programs that may have vulnerabilities that can result in opportunities for malicious parties to steal your crypto. Think, among others, of viruses, malware and keyloggers. Also, the private key of your software wallet must be temporarily decrypted in the RAM (Random Access Memory) when you send (sign) a transaction. These are all reasons why you never want to have too much value on a software wallet.
A hardware wallet, on the other hand, is usually offline and made for one purpose only: to manage your crypto as safely as possible. The less code a Hardware Wallet has to run, the fewer the potential for bugs and the smaller the attack surface will be. Some hardware wallets can even be used "air gapped" and never need to be connected to the internet themselves.