What plt.subplots() doing here?
As you can read from here

plt.subplots() is a function that returns a tuple containing a figure
and axes object(s). Thus when using fig, ax = plt.subplots() you
unpack this tuple into the variables fig and ax. Having fig is useful
if you want to change figure-level attributes or save the figure as an
image file later (e.g. with fig.savefig('yourfilename.png'). You
certainly don't have to use the returned figure object but many people
do use it later so it's common to see. Also, all axes objects (the
objects that have plotting methods), have a parent figure object.

The parameter bins is used to set the number of ranges to be used to accumulate the data in those ranges. I don't know where else you have question.