See the Euler-Lagrange correspondence, Euler to Lagrange, Berlin, le 3 Mai 1766 :
Euler is leaving Berlin for Pétersbourg and it seems that he is trying to "enroll" Lagrange for the project ["le dessain de l'Impératrice"] of "rétablir l'Académie de Russie".
If so, we can conjecture that, in addition to Lagrange's shyness, the motivation behing Lagrange's refusal was the same of his previous refusal to join Euler in Berlin: a tacit refusal to be the "second great Mathematicians".
Only when Eluer leaved Berlin, Lagrange agreed on d'Alembert proposal to leave Turin and move to Berlin.
Unfortunately, I'm not able to access d'Alembert-Lagrange corresponsence; but we can see :
Before 1766, Frederick II of Prussia had more than once invited both d’Alembert and Lagrange to move to Berlin. The encyclopaedist had declined the offer and suggested the name of his Turinese friend. But Lagrange, even though he was on good terms with Euler, did not relish a "cohabitation" with him in the Berlin Academy. The situation changed at the beginning of 1766, and in a letter of 6
March 1766 d’Alembert spoke of Lagrange about it in these terms:
M.Euler s’en va, dit-on, à Pétersbourg pour quelque mécontentement qu’il a eu à Berlin. Je lui ai écrit pour l’en dissuader. S’il s’en va, et que vous vouliez
le remplacer, vous n’avez qu’à m’écrire un mot et je ferai de mon mieux pour vous servir. (Mr Euler is leaving, he says, for St.Petersburg because of some unhappiness he has had in Berlin. I wrote to him to dissuade him. If he leaves, and you want to replace him, you have only to write me and I will do my best to serve you.)
D’Alembert also wrote to Frederick II in praise of Lagrange, and in his letter of 26 April 1766, he announced to the erudite Turinese scholar:
Mon cher et illustre ami, le roi de Prusse me charge de vous écrire que, si vous voulez venir à Berlin pour y occuper une place dans l’Académie, il vous donne 1500 écus de pension qui sont 6000 livres argent de France; … M.Euler mécontent pour des raisons dont je ne sais pas bien le détail, mais dans lesquelles je vois que tout le monde lui donne le tort, demande son
congé et veut s’en aller à Pétersbourg. Le roi, qui n’a pas trop d’envie de le lui accorder, le lui donnera certainement si vous acceptez la proposition qu’on
vous fait;…. (My dear and illustrious friend, the king of Prussia has charged me to write you that, if you would like to come to Berlin to occupy a place in the Academy, he would give you a pension of 1,500 crowns, which are 6,000 French pounds … Mr Euler, unhappy for reasons of which I do not know the details, but in which I see that everyone thinks him wrong, requests permission to leave and wants to go to St. Petersburg. The king, who was not too anxious to grant it, would definitely give it to him if you accept the proposition that he has made; ….)
Reading the epistolary exchanges between the two scientists shows that they shared a common correspondence of 1764–1765, one can feel the rise in Lagrange’s bitterness that will lead him into exile. As Marco Segala [ Lagrange. Why I left Turin and never went back again, Nuncius, Volume 25-1, pages 23–40, 2010] shows, a low, stagnant salary forced him to teach in a rather hostile environment, and uninterested
in theory, the contempt of Piedmont authorities for science and remoteness of European intellectual centres led Lagrange to leave his country and accept the offer of d’Alembert and Frederick II in Berlin. He regrets that in Turin, "on regarde la science dont [il s’]occupe comme très inutile et meme ridicule (one regards the science with which I am occupied as quite unnecessary and ridiculous," letter of 10 May 1766). Fearing that his letters to d’Alembert
might be intercepted, he also used roundabout methods to deliver correspondence to Paris. But the King of Sardinia did not allow him to leave very easily. He had made up his mind to accept Frederick II’s offer, but he was
not granted permission to leave Turin until early July 1766. Lagrange left Turin definitively on 21 August 1766 and arrived to Berlin at the end of October, after a short time spent in Paris and London. Thus began for Lagrange a new
period of intense scientific production.