Why default behavior of section title is to overflow

The default behaviour isn't (directly) to overflow, but is to be justified, however with large heading fonts there are rather few inter-word spaces so justifying is rather difficult especially as there are high penalties for hyphenating a two-line paragraph (and you probably don't want a hyphenated section heading).

As usual with TeX's paragraph line breaker, it will go over-full and warn rather than stretch inter-word space beyond the constraints specified.

If you expect to have long headings, they should probably be set raggedright:

enter image description here

\documentclass[12pt]{article}
\begin{document}
\section{Algebraic Geometry -- Localization and Germs of Functions}

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\raggedright
                                    \normalfont\Large\bfseries}}
\makeatother

\section{Algebraic Geometry -- Localization and Germs of Functions}

\end{document}

David has taught you why it happens and suggested a remedy. You can take a shorter route, which basically amounts to the same, but avoids plunging into the details:

\documentclass[12pt]{article}

\usepackage{sectsty}

\allsectionsfont{\raggedright}

\begin{document}

\section{Algebraic Geometry - Localization and Germs of Functions}

\end{document}

enter image description here