Explaining dark matter halo density profiles with neural networks