I imagine that we get exp for killing enemies, solving puzzles, finding secret locations, exploring the map, passing skill checks/proficiencies/dialogue options where we can avoid combat, or deal with the obstacle in an unorthodox manner. Based on Larian's previous works and BG history.