The phone communicates to cell towers, if it can find 3 towers in range it can tell the distance from each tower and if it knows the location of each tower, the phone can "figure out" where it is. It triangulates its position based on the strength of the cell tower signals.
This method is not that accurate, but it can determine the location within 100m