An addendum to this question is, why weren't they in Alexandria to begin with?
The best source for this question is Dio Cassius (book 42). He mentions that the Egyptian land forces of Ptolemy were at Pelusium when Caesar landed at Alexandria. Pelusium was at the northeastern edge of the Nile delta, at the natural interface between Egypt and the kingdoms further east. The Egyptian army apparently stayed there while Caesar was at Alexandria playing king. Finally the tensions boiled over:
By this action they were temporarily calmed, but not long afterward were roused even to the point of making war. For Pothinus, a eunuch who was charged with the management of Ptolemy's funds and who had taken a leading part in stirring up the Egyptians, became afraid that he might some time have to pay the penalty for his conduct, and he accordingly sent secretly to Achillas, who was still at this time near Pelusium, and by frightening him and at the same time inspiring him with hopes he made him his associate, and next won over also all the rest who bore arms. To all of them alike it seemed a shame to be ruled by a woman — for they suspected that Caesar on the occasion mentioned had given the kingdom ostensibly to both the children merely to quiet the people, and that in the course of time he would offer it to Cleopatra alone — and they thought themselves a match for the army he then had present. So they set out at once and proceeded toward Alexandria. (Dio 42.36; transl. Cary)