This occurs in the 2009 Star Trek movie. The scene depicts Kirk's unorthodox approach to the test, where he "cheats" by reprogramming the simulation to create a winnable scenario. He then casually eats an apple while the simulation runs its course.
The apple-eating is a symbolic gesture. It highlights Kirk's rebellious nature and his willingness to break the rules in order to succeed. It's a moment that foreshadows his later career as a Starfleet captain, where he'll often rely on his intuition and courage to overcome seemingly insurmountable challenges.
While the scene is memorable, there are no other instances in the Star Trek franchise where Kirk eats an apple during the Kobayashi Maru test.