The fish brains are anatomically by far more similar to the mammalian brains than people used to think. Taking advantage of this evolutionary conservation and its structural simplicity, we have been studying zebrafish brain to elucidate the mechanism of two aspects of adaptive brain functions, i.e. resolution of social conflict and decision making. The habenula (Hb) is an evolutionarily conserved diencephalic structure. We discovered that the dorsal and ventral Hb (dHb and vHb) of zebrafish correspond respectively to the medial and lateral regions of mammalian Hb. We have recently found that the two subregions of the dorsal habenula (dHb) in zebrafish antagonistically regulate the outcome of conflict. We now show the evidence that the habenula plays the evolutionarily conserved roles in the resolution of social conflict in mammals. We also use adult zebrafish as a model animal for the study of decision making in visual-based active avoidance tasks by establishing the closed-loop virtual reality (VR) system for the head-tethered adult zebrafish with the 2-photon calcium imaging system. We have identified two ensembles of neural activities which encode the different aspects of prediction errors between the status represented by the real sensory inputs and the favorable status to achieve to successfully escape from the danger, i.e. visual inputs of the backward moving landscape and the wall color of the goal compartment, and observed that the behaviors are taken so that these errors become minimum. Our results show that the adult zebrafish behaves in decision making based on the behavioral rule called active inference, where agents take actions to suppress the prediction errors by trying to make the internal representations of the bottom-up sensory states best match those of the top-down predictions, and have demonstrated the strong conservation of the basic principle of decision making throughout the evolution.