"I forgot to eat an apple yesterday."
Translation:Dün elma yemeyi unuttum.
You can't. It has to be in the accusative, because it's the object of "I forgot".
I forgot the umbrella → şemsiyeyi unuttum.
I forgot to eat → yemeyi unuttum.
The only exception I can think of is "istemek", (to want), which can accept an infinitive: "yemek istiyorum - I want to eat".