Unraveling Microscopic Origins Of Complex Behavior Of Carbon And Sodium With Neural-Network Potentials