Why using this!

fig, ax = plt.subplots()

What is going on at the back of python when performing this function?

Hi keswani06

plt.subplots creates a figure and a grid of subplots with a single call, while providing reasonable control over how the individual plots are created.
subplots() without arguments returns a Figure and a single Axes.
Check this for more details.