This paper introduces a novel and complete framework for solving different Internet of Things (IoT) applications, which explores eXplainable AI (XAI), deep learning, and evolutionary computation. The IoT data coming from different sensors is first converted into an image database using the Gamian angular field. The images are trained using VGG16, where XAI technology and hyper-parameter optimization are introduced. Thus, analyzing the impact of the different input values in the output and understanding the different weights of a deep learning model used in the learning process helps us to increase interpretation of the overall process of IoT systems. Extensive testing was conducted to demonstrate the performance of our developed model on two separate IoT datasets. Results show the efficiency of the proposed approach compared to the baseline approaches in terms of both runtime and accuracy.