The intellectual roots of AI, and the concept of intelligent machines, may be found in Greek mythology.
Intelligent artifacts appear in literature since then, with real (and fraudulent) mechanical devices actually demonstrated to behave with some degree of intelligence.
After modern computers became available, following World War II, it has become possible to create programs that perform difficult intellectual tasks. From these programs, general tools are constructed which have applications in a wide variety of everday problems.
*(Pictures: freepik.com & livescience.com/)