We examine the concept of knowledge externalities, namely the benefits that co-located firms receive in terms of knowledge, focusing on the role of interactive learning processes and adopting the single firm perspective, whereas in literature their role has mainly been analyzed adopting the system perspective and focusing on knowledge spillovers. The geographical clustering process is studied as an emerging property of a system made up of independent firms making location choices. The aim of the paper is to analyze how the firm heterogeneity affect the geographical clustering process. In fact, so far literature and empirical evidence do not provide a conclusive answer to this regard. To pursue our aim, an agent-based model of geographical clustering is developed, based on knowledge externalities produced thanks to learning by imitation and learning by interaction and a simulation analysis is then carried out. The main result is that the heterogeneity reduces the willingness of firms to geographically cluster and enhance the development of knowledge.