In elementary treatments of algebraic varieties, a regular morphism between affine varieties is one whose components are all polynomials, and the coordinate ring as a ring of polynomial functions.
When defining the sheaf of regular functions on a variety $X$, then you have for any basic open set $D(f)$, the nonvanishing locus of a polynomial $f$, that $\mathcal{O}(D(f)) = \mathcal{O}(X)_f,$ which is the ring obtained by adjoining $1/f$ to the coordinate ring of polynomial functions. This is for example explained by user D_S here or the sources linked by Nils Matthes in this answer. We started by looking at polynomials, and then decided to include $1/f$. I understand including $1/f$ when we look for the rational functions, but the multiplicative inverse of a polynomial is definitely not polynomial. What is the justification for adding it, is there something stronger than "because it's nonzero on $D(f)$ therefore $1/f$ is defined. We add it because we can".
The proofs in those linked sources start out as defining a regular function as "locally a quotient of the form $g/h$ where $h$ doesn't vanish. So they appear to be just assuming the thing I am looking for justification of.
I'm not asking what inverting elements has to do with localization,which has some good answers on this site already. I liked Viktor Vaughn's answer on this thread and Jesko Hüttenhain's in this one.