A digital twin is an enhanced digital representation of a real system. Digital twins are able to mimic the operation of physical systems and use data captured from their sensors to detect abnormal conditions and diagnose the cause of the problem. This paper discusses digital twin concept in general and describes the process of developing a digital twin for electric submersible pump (ESP) systems. It includes a description of the different subsystems interacting with the ESP equipment and the physics governing dynamics of each subsystem and the implementation of the digital versions. The ESP digital twin considered in this paper encompasses the ESP lifted well and includes digital versions of the ESP string, well completion, well fluids, and near wellbore reservoir, among others. The document also describes the implementation of the physics models into a simulator capable to represent diverse operating conditions of the system, including failures and transients. Finally, the paper discusses the applications of the ESP digital twin, especially in the development of artificial intelligence (AI) systems for equipment monitoring and failure prediction.