Why is Oxford called 牛津? Most chinese words about the name of foreign places are mapped phonetically, such as 华沙, 纽约 or 首尔, I believe. But in some cases it is from the historical incident, such as 旧金山 (I don't know how many are from this rule). Also, Japanese places are directly from the equivalent Japanese characters, such as 东京 or 北海道.

But why is Oxford called 牛津?

Also, in general is there any rule regarding that the word should be mapped phonetically or not?

The related question focuses on who decides the names but I would like to ask how they are decided.
This is a rare example of Chinese translation for foreign cities or the similar, there's no rule to govern this type. In short it translates literally the meaning of Oxford:
Ox: 公牛， 牛
Ford: ferry, 津,水渡也。——《说文》
Hence, Oxford == 牛津

The meaning of ferry in 津 is not seen often in modern Chinese, here are a few examples:
天津， 天子之津渡。
城阙辅三秦 风烟望五津  ----送杜少府之任蜀川   王勃
无人问津 ---成语

Also two examples of naming:
Little Rock, 小石城
Springfield， 春田市， 斯普林菲尔德 also work.