I just found out that the Eruv was established by Shlomo Hamelech Alav Hashalom and the Sages.
THE BEN ISH CHAI EXPLAINS WHY THE ERUV IS NOT A LENIENCY
In the Gemarah it is written: When King Salomon peace be upon him established the law of the Eruv and the washing of the hands [Netilat Yadaim], a celestial voice declared: “My Son if your heart is wise, my heart will be also gladdened (Mishle 23:15). Talmud Shabbat 14. And one can ask Why do they said this verse when he also instituted Netilat Yadaim and not only regarding the Eruv? And it seems to me with the help of heaven, that when the law of Eruvim were established, there arose the opportunity for foolish and simple people to argue that the Eruv was established for enjoyment, in order to lift the heavy burden of the prohibition to carry from one place to the other and that the intention is not Le Shem Shamaim and the spirit of Hashem is not involved in this decree; But after King Salomon also decreed Netilat Yadaim which involves great discomfort and a great yoke which forbids man to eat without washing his hands, and sometimes it is very cold and it is difficult to wash, and sometimes there is no water ready for Netilat Yadaim, then we see the great burden King Salomon brought upon him and upon the whole world, But through this we see that the spirit of Hashem is present with King Salomon and that his actions were Le Shem Shamaim, and then we see that the spirit of Hashem was also there in the decree of Eruvim and that it was not decreed to take any burden away, G-d forbid, and then given that he issued the two decrees of Eruvim and Netilat Yadaim the verse says about him: “My son if your heart is wise…to hold on to the truth and the real will of Hashem then my heart will also be gladdened because now my son you are wise in having decreed Netilat Yadaim and you will prevent any criticism on having instituted Eruvim so that no one will say that from your heart you wished to establish the Eruv in order to derive pleasure and he who makes light on the words of the Sages is as if he opposes and contradicts the SHECHINA. (The Ben Ish Chai, Ben Yehoyada Shab 14)
From Israel613.com -under topic- Eruv