Pacman was created for arcade machines and later for the Nintendo-type systems. In both, the game was programmed in machine-specific assembly code. Thus there is no real "source code" for pacman.
You may however find some copies on the net of implementations people have created in their spare time.
All that pacman is is a matrix of barriers and powerups. Then pacman wanders the maze and when he passes over all the dots data the next level begins. The "AI" of the ghosts is to wander around randomly on the map.
It looks like you're new here. If you want to get involved, click one of these buttons!