https://en.wikipedia.org/wiki/Finite-state_machine
From there you can deep dive into subjects like digital logic and automata theory.