ASV notes on Genesis 21:22-34

The king Abimelech and his general Phicol knew Abraham and his private army that eradicated the four kings from the east, Abraham was in their mind a threat to their kingdom. But the interest of Abraham was water for his animals.

The king and his general came and wanted Abraham to swear to keep his word and treat Abimelech and his descendants fairly. They stood by a well that Abraham had dug. There they both swore, Abraham not to be hostile to the king’s people and Abimelech swore that the well was dug by Abraham and they called the well Beersheba, the well of the oath. This was in the same area where an angel spoke to Hagar.

Abraham was powerful in the eyes of Abimelech, but the main reason, I think, that the king feared Abraham was that he saw God blessing him in everything, Abimelech feared Abraham’s God. Abraham planted a tamarisk in the area as a witness of his awesome God, and there he called on His name; YAHAWAH.