The first image is the gif unoptimized, the second image is the gif optimized when exported. Both images had the "replace layer" option selected. Any idea what I could do to get a middle ground with no trail and no grainy effect?
You have to get back to the original image. The frames in the second image contain a trail of the previous frames. This is your top frame layer alone:
As far as I can tell the optimization done by Gimp is that pixels in a frame that are identical to those of the previous frame are replaced by transparency. The result is then auto-cropped. But the whole process assumes that the frames are initially all opaque, this doesn't play well when there are transparent parts.