Since each neuron in a NN receives input from the previous layers, but they may differ in terms of their weights and biases. As the network learns, the weights and biases are adjusted differently to improve the overall performance of the network by minimizing the overall cost function. This means that each neuron may become specialized in certain types of input.
Edited:- You may also refer to this thread and comment, which discusses the behavior of neural networks. It could provide additional insight into the topic we are discussing.
Best,
Mujassim