When should I learn artificial intelligence?
You will need some discrete mathematics. Graphs, trees, and so forth. These are the structures underlying AI.

You will need some programming skills, especially in languages such as Prolog and LISP.
A lot of AI systems are programmed in these languages. 

You will need some logic. Propositional and predicate calculus. Their syntax and semantics. Perhaps some modal logic. This will form the basis for learning about knowledge representation, which is at the basis of AI.

During the first two years of a regular computer science degree you usually obtain enough background to start studying AI .

But there is no limit to how complex AI can be. To get deeper into it, you'll need statistics, calculus, matrix algebra, and probably much more. Statistical learning theory (or more simply machine learning) depends on these areas.

My advice. Buy a book on Artificial Intelligence to read in your own time.
A good one is Artificial Intelligence: A Modern Approach by
Stuart Russell and Peter Norvig. Whenever you don't understand something, try to work out what background knowledge you are lacking. Then fill those gaps.