There are two answers to this:
1) God created an intelligent being with a conscious and complex reasoning for whatever purpose.
2) We evolved from the three fundamental tools of intelligence. These are (in order) access to information, storing it in memory and learning. Organisms that couldn’t process information (**i.e**: sight, sound, touch etc) probably died almost immediately. Organisms that could process information and recollect it in memory would also die rather quickly, but may have been able to reproduce through chance. Lastly being able to process information and learn from it had the highest chance of survival.
We are simply beings that have considerably evolved from that ancestor through millions of years.
Latest Answers