In simple words, Artificial Intelligence is using algorithms to make the machines to get smarter in executing tasks by themselves.
IoT, on the other hand, is connecting devices online/offline through web and facilitate switch on/off, switch on/off lights, or lock/unlock doors virtually.
Currently, IoT and AI technologies have great scope and are revolutionizing the way technology benefits are delivered to you.
If you are interested in IoT, I recommend this IoT Course by Intellipaat.
Also, watch this video on IoT, ML, and AI: