Elohim is one of the primary names of God in the Torah. Grammatically it looks plural, yet it always takes a singular verb, a constant reminder that He is One. Our Sages teach that each name reveals a different way God relates to the world: Elohim expresses midat hadin, the attribute of justice, power and sovereignty over all creation, while the four-letter Name (Hashem) expresses mercy and the intimate covenant with Israel. Rashi on the very first verse of the Torah spells this out: the verse says "Elohim created" and not "Hashem created" because God first thought to create the world with strict justice, saw it could not endure, and joined mercy to it [S6].
Now to the ה־ prefix. HaElohim, "THE God," is the definite form. It points to the one true Judge and Authority, as opposed to any other power people might imagine. This is exactly the phrase Moses uses when he sums up the lesson of Sinai: "Hashem, He is HaElohim, there is none beside Him" (Deuteronomy 4:35). The same form opens the Akedah: "And HaElohim tested Abraham" (Genesis 22:1). Whenever the Torah wants to stress God acting as the supreme Judge who weighs and tests, HaElohim is the natural choice.
Genesis 6:11 The earth became corrupt before God; the earth was filled with lawlessness.That is why our verse says the earth was corrupt "before HaElohim." The generation of the Flood is standing before God the Judge, and the verdict is about to be pronounced. Rashi explains that the corruption ('ותשחת') refers to immorality and idolatry, and the 'violence' (חמס) refers specifically to robbery/theft [S2][S3]. Ibn Ezra adds that 'before God' (לפני האלהים) may mean either openly/in public, or in a way only God can see [S5]. Two verses later Rashi makes the courtroom explicit: "their decree of judgment was sealed only because of robbery" [S7]. So the name matches the moment: a world that has broken every boundary meets the One true God in His attribute of justice.