This paper presents a new method for generating encryption keys for Internet of Things (IoT) devices. This method combines chaos theory with neural networks to create secure and efficient keys. We use the Lorenz chaotic system to generate complex patterns and a Convolutional Neural Network (CNN) to learn and predict these patterns. This approach is designed to address the unique security challenges of IoT devices, which often have limited computing power. We tested our method with different key sizes and evaluated its performance using accuracy, loss, entropy, and correlation metrics. The results show that key sizes between 256 and 512 bits offer the best balance between model performance and security for IoT devices. We also conducted Diehard statistical tests, which our key generation method passed successfully, demonstrating its ability to produce high-quality random keys.