The Grandmaze was created by KAOS-com at some point in the past. It was launched into space for unknown reasons, and came to rest on Dream Land. King Dedede repurposed it as a giant execution chamber. It remained so for 50 years, still controlled by KAOS-com. It was used to contain Gimmick V and numerous dangerous criminals.
The Grandmaze has a number of obstacles it can instantly manifest. These include:
As noted by Prince Bebebe, it is perpetually dark inside the Grandmaze.
When the Grandmaze was released as a software and "mazed" all of Dream Land, it caused people to get lost after 3 steps anywhere.
Gimmick V was aware of a weak point at the center of the Grandmaze. When he struck this, the Grandmaze was shattered and KAOS-com suffered extreme pain. This implies that the Grandmaze was an extension of KAOS-com's self.
If KAOS-com is alive, he will probably construct a new Grandmaze, or a replacement of some kind.