The Latin rivalis, whence our word rival, referred to one who lives on the same stream with another, it came from rivus, a brook.
That would make any such two persons neighbors, of course. But the ancients had many things in common with men of today. Two people who share the same stream are inevitably at odds.
Each wishes to use the water in his own way, and is constantly contending with the other. If one uses the stream for irrigation, the other has no water for his cattle.
In such fashion, rival came to mean one who contends with another for the same object.