If $S\subset A$ is a multiplicative set then $$\operatorname{gldim}(S^{-1}A)\le\operatorname{gldim}(A)$$ since $\operatorname{pd}_{S^{-1}A}(S^{-1}M)\le\operatorname{pd}_AM$ and every $S^{-1}A$-module is of the form $S^{-1}M$ with $M$ an $A$-module.
Suppose now $$\sup_{\mathfrak m\in\operatorname{SpecMax}A} \operatorname{gldim}(A_{\mathfrak m})<\operatorname{gldim}(A)=n<\infty.$$
Let $M$ be a finitely generated $A$-module with $\operatorname{pd}_AM=n$. Then $\operatorname{pd}_{A_{\mathfrak m}}M_{\mathfrak m}\le n-1$. (Recall that $\operatorname{gldim}(A)=\sup\operatorname{pd}_A(M)$ with $M$ finitely generated.) Consider a projective (free) resolution of $M$ of length $n$, and denote by $K_i$ the $i$th syzygy of $M$, that is, the kernels of the maps in a projective resolution. Since $\operatorname{pd}_{A_{\mathfrak m}}M_{\mathfrak m}\le n-1$ we get that all localizations $(K_{n-1})_{\mathfrak m}$ are projective (free). It follows that $K_{n-1}$ is finitely generated and flat, so it is projective. This entails $\operatorname{pd}_{A}M\le n-1$, a contradiction.