Artificial intelligence (AI) is a discipline of computing that focuses mostly on transferring human intelligence and mental processes into machines that can assist humans in many ways. Machine learning (ML) is the approach of choice in AI for creating useful software for computer vision, speech recognition, natural language processing, robot control, and other applications. Some of the most common analyses of large, complicated and multidimensional data sets in astronomy can be performed by using ML methods. It can be used for automating observatory scheduling to increase the effective utilization and scientific return from telescopes. It is also used for image recognition, classification of galaxies and planet recognition. This paper offers an in-depth review of the evolution of artificial intelligence and the use of AI and ML in the field of astronomy, especially for data analysis, image recognition, astronomical scheduling, classification of galaxies and planet recognition. It adds to the existing literature on use of artificial intelligence for astronomical applications and is a useful resource for students and researchers.