I keep coming back to this subject because so many people ask about it. I've posted about Portuguese adverbs of position & place before, but today I just want to review the super-common two:
perto de: close to
longe de: far from
It's obvious why the de is there, right? Brazilians say (literally):
The beach is close OF the hotel. >> A praia fica perto do hotel.
My office is far OF the beach. >> Meu escritório fica longe da praia.
* You can replace the of with from, and it's the same thing.
Where we would say TO, they say OF or, FROM. Not always, just in these examples. Just when talking about distances. Location & Position as well.
What would happen if you forgot to contract and said for example, A praia fica perto de o hotel.
Not a problem.
Brazilians will understand you perfectly.
It's just not a nice sounding as when the de + o is combined.
Try saying, Eu estou longe da cidade. Now say, Eu estou longe de a cidade.
See what I mean?
As soon as you've got the feel for these, you'll notice that there are many more cases where there is a de placed right after a word. And, that most of the time the word is one describing location or, position. This use of this de is so common in Portuguese that it's a rule: adverbs of position