It is possible to model trust as an investment game, where a player in order to receive a reward or a better outcome, accepts a certain risk of defection by another player. Despite having achieved interesting insights and conclusions, traditional game theory does not predict the existence of trust between players who are selfish and exhibit maximizing behavior. However, experiments with these games reveal the presence of trust in player decision making. The purpose of this paper is twofold. First, it aims to build an agent-based economic model to show that trust revealed in these experiments can emerge from a simple set of dynamics. Using the generative methodology proposed by Epstein, we introduce natural selection, learning and group formation to the model to verify their impact on the emergence of trust between agents. Second, since the experiments reveal that the participants present bounded rational behavior, the paper aims to show that in an agent-based model, bounded rationality can be modelled through an artificial intelligence algorithm, the learning classifier system (LCS). As a result, we have observed that natural selection favors more selfish behavior. In addition, learning and the forming of groups increased trust in our simulations and they were able to reverse selfish behavior when introduced along with natural selection. The level of trust that emerged from the model with these three dynamics was similar to that observed in these experiments. Finally, it is possible to verify that the LCS was able to model bounded rational behavior in agents.