This paper addresses the task of flexibly modifying cognition and behavior based on goals. Humans possess the ability to generalize behavior to new situations by leveraging past episodic memories, a capability believed to stem from the interaction between the prefrontal cortex (PFC) and the hippocampus (HPC). This study presents a reinforcement learning model that integrates the PFC-HPC interaction mechanism for goal-directed generalization. The PFC generates query-key representations for encoding and retrieving goal-relevant episodic memories and modulates HPC memories in a bottom-up manner based on current task demands. Furthermore, it dynamically adjusts encoding and retrieval strategies based on the presentation of multiple goals. Experimental results demonstrate that the combination of working memory and selectively retrieved episodic memories enables decision transfer across similar environments. Furthermore, PFC's bottom-up control of the HPC enhances learning of arbitrary structural associations between events for generalization to new environments compared to a top-down, sensory-driven approach. Furthermore, we demonstrate that the PFC encodes generalizable representations during the encoding and retrieval of goal-relevant memories, whereas the HPC exhibits event-specific representations. In conclusion, we highlight the importance of goal-directed prefrontal control of hippocampal episodic memory for decision-making in novel situations and suggest a computational mechanism by which PFC-HPC interactions enable flexible behavior.