An artificial intelligence is a machine with the ability of complex reasoning, form new conclusions and alter its responses.
During the 23rd century, Starfleet trialled the M-5 computer, a computer that could think and reason like a human. It was installed and tested on the USS Enterprise during a battle simulation. The test was a failure after the computer killed several hundred crew on the USS Excalibur. (TOS: "The Ultimate Computer")
The Federation has encountered numerous advanced androids, mostly built by other civilisations. Several have even served in the Federation Starfleet, such as Data, Enigma and Omega. (Star Trek: The Next Generation; Tales of the Seventh Fleet; Star Trek: Phoenix-X)