In the illusion, the coffin is set high on a mound of dirt overlooking an open grave. G.O.B.'s plan is to lay inside the coffin and then slip out the trap door in the back before the wood box is placed in the grave and covered in six feet of dirt.
What went wrong
The illusion is part of a distraction to keep Buster Bluth from learning that his father, George Bluth, is dead. (The irony being that George Sr. isn't dead at all). When Buster learns George Sr. is dead (remember, he isn't actually dead), the youngest of the Bluth brothers freaks out, sending G.O.B. tumbling into the pit, followed by the coffin and a dumptruck load of dirt. However the audience begins to clap, assuming G.O.B. has done the illusion correctly. A little while after, Michael tells his son that he has to dig up G.O.B.