Hackers create botnets by infecting vulnerable devices with malware, turning them into remotely controlled bots. They use phishing, software exploits, and brute-force attacks to spread infections, building massive networks for launching cyber attacks like DDoS, spam, and data theft.