Purpose of the gridiron: certain play types (forward pass and certain runs, IIRC) required the player to be more than 5 yards laterally from where the ball was snapped. The endzone to endzone lines assisted the officials in determining this. The sideline to sideline yard lines were added to assist with judging if sufficient distance was gained (or at one time, lost!) for a first down.
The game is called football because that was the name used for the loosely organized games that eventually became codified as Association Football, Rugby football, American football, Australian rules football, etc.