The ghosts are there to chase and "eat" Pac-Man—that's the whole point of the game. They're the enemies you have to outmaneuver, and their pursuit is what gives Pac-Man its challenge and tension.