A Turing machine is a mathematical model of computation that consists of an infinite tape divided into cells, a head that reads and writes symbols on the tape, finite states, and transition rules. It was invented by Alan Turing in 1936 to formalize the idea of an algorithm. A Turing machine operates by reading a symbol on the tape, updating its state and writing a new symbol based on transition rules, then moving the head left or right. If it reaches an accepting state, the input is accepted. A language is recursively enumerable if it is accepted by a Turing machine.