The Arizal teaches (in multiple places in the Shmonah She'arim) that Hashem created this world in order to be called His many names, such as Merciful, Master, etc. If there is no one to have mercy upon, there cannot be The Merciful One.
The Ramchal taught slightly differently. In his commentary to Otzrot Chaim he states:
And this is not the primary reason, but rather the secondary. The primary purpose is the matter of bestowing good.One of the Ramchal's primary teachings is that Hashem wanted to bestow good upon others. As such, there is a need to create creations upon which to bestow this good. However, bestowing good upon someone which is not earned is a cause of shame. Therefore there is this world, in which we gain merit to really be the owners of this good that Hashem will bestow upon us.
And as a result of this reason for creation's existence, we are able to call Hashem by all these names, through our experiencing of Hashem's characteristics in this world.