Pharaoh Atem is the spirit residing in the Milennium Puzzle. After a historic battle against Zorc Necrophadius, he had sealed his soul along with Zorc in order to save Egypt. However, he had lost his memory as a result.
3,000 (5,000 in the dub) years later, Yugi Mutou, after trying to solve the puzzle for eight years, awakens Atem from his slumber, although Yugi does not realize this until much later in the story, more specifically, Duelist Kingdom.
At the end of Duelist Kingdom, Atem asks Yugi to help him recover his memories and Yugi agrees to help him. Battle City