District heating systems are gaining global recognition as an essential tool for reducing greenhouse gas emissions and transitioning to a low-carbon-energy future. In this context, heat pumps are becoming an important technology, providing an effective solution for improving energy efficiency and reducing the reliance on fossil fuels in heating systems. Therefore, this study is focused on the optimal selection of heat pump systems for different types of buildings considering technical, economic, environmental, and social factors. This paper proposes a novel methodology based on mixed-integer nonlinear programming and multi-objective optimization that minimizes total costs and reduces CO2 emissions for heat production and supply systems over a desired period. The methodology is applied to various building types, including renovated and unrenovated apartment buildings, schools, kindergartens, and a supermarket. The study analyzes various types of heat pumps and electric heaters for space heating and domestic hot water production. Optimization results showed that the optimal heating system includes air-to-water heat pumps and electric heaters. Furthermore, for schools and a supermarket, these systems are combined with hybrid heat pumps. The goal of making the heating system neutral in terms of CO2 emissions was achieved for eight out of eleven buildings analyzed. The most profitable investments were in the heating systems of renovated five-story and unrenovated nine-story apartment buildings due to their low energy costs (0.0831 EUR/kWh), short payback periods, and high returns on investment.