Declaring option a4paper in \documentclass produces different margins than declaring it in \geometry

I think the clearest way to see the differences is to use package layout showing you the current writing area and margins and several length of the document in mm.

Please see this code

\documentclass[a4paper]{article}

\usepackage{layout}
% from https://tex.stackexchange.com/questions/173244/to-display-the-lengths-in-millimeters-by-default
\makeatletter
\renewcommand*{\lay@value}[2]{%
  \strip@pt\dimexpr0.351459\dimexpr\csname#2\endcsname\relax\relax mm%
}
\makeatother


\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas nec
lobortis justo. Praesent ut scelerisque risus, sit amet mollis erat.
Fusce at lacus at libero consequat consectetur.

Proin at vehicula ligula. Vivamus quis ligula id lacus aliquet
ultricies. Vivamus tristique, velit vestibulum tincidunt fermentum,
lacus sem euismod risus, ut volutpat augue dolor vitae est. Proin odio
nunc, sollicitudin quis nisi a, sodales efficitur quam. Phasellus ex
velit, porttitor vestibulum consectetur eu, maximus et nisi.

Nulla pharetra augue ex, quis scelerisque sem iaculis id. Aliquam in
tincidunt quam. Praesent ac laoreet elit. Aenean varius ullamcorper
dolor ac finibus. Proin est sapien, tempor nec mollis ut, ultricies et
ante. Maecenas hendrerit velit non augue rutrum, mollis pharetra nisl
auctor. Ut nisl mauris, porta ut nisi ut, elementum tristique nibh. 
\clearpage
\layout
\end{document}

and the resulting layout:

enter image description here

Now please compare the result above with this code

\documentclass{article}

\usepackage[a4paper]{geometry}
\usepackage{layout}
% from https://tex.stackexchange.com/questions/173244/to-display-the-lengths-in-millimeters-by-default
\makeatletter
\renewcommand*{\lay@value}[2]{%
  \strip@pt\dimexpr0.351459\dimexpr\csname#2\endcsname\relax\relax mm%
}
\makeatother


\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas nec
lobortis justo. Praesent ut scelerisque risus, sit amet mollis erat.
Fusce at lacus at libero consequat consectetur.

Proin at vehicula ligula. Vivamus quis ligula id lacus aliquet
ultricies. Vivamus tristique, velit vestibulum tincidunt fermentum,
lacus sem euismod risus, ut volutpat augue dolor vitae est. Proin odio
nunc, sollicitudin quis nisi a, sodales efficitur quam. Phasellus ex
velit, porttitor vestibulum consectetur eu, maximus et nisi.

Nulla pharetra augue ex, quis scelerisque sem iaculis id. Aliquam in
tincidunt quam. Praesent ac laoreet elit. Aenean varius ullamcorper
dolor ac finibus. Proin est sapien, tempor nec mollis ut, ultricies et
ante. Maecenas hendrerit velit non augue rutrum, mollis pharetra nisl
auctor. Ut nisl mauris, porta ut nisi ut, elementum tristique nibh. 
\clearpage
\layout
\end{document} 

and its result ([a4paper] is option of package geometry):

enter image description here

You see the different length for \textheight and \textwidth? At last that means that geometry uses different standard margins than class article without geometry.

Now have please a look to this code, having option [a4paper] only placed as class option for article:

\documentclass[a4paper]{article}

\usepackage{geometry}
\usepackage{layout}
% from https://tex.stackexchange.com/questions/173244/to-display-the-lengths-in-millimeters-by-default
\makeatletter
\renewcommand*{\lay@value}[2]{%
  \strip@pt\dimexpr0.351459\dimexpr\csname#2\endcsname\relax\relax mm%
}
\makeatother


\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas nec
lobortis justo. Praesent ut scelerisque risus, sit amet mollis erat.
Fusce at lacus at libero consequat consectetur.

Proin at vehicula ligula. Vivamus quis ligula id lacus aliquet
ultricies. Vivamus tristique, velit vestibulum tincidunt fermentum,
lacus sem euismod risus, ut volutpat augue dolor vitae est. Proin odio
nunc, sollicitudin quis nisi a, sodales efficitur quam. Phasellus ex
velit, porttitor vestibulum consectetur eu, maximus et nisi.

Nulla pharetra augue ex, quis scelerisque sem iaculis id. Aliquam in
tincidunt quam. Praesent ac laoreet elit. Aenean varius ullamcorper
dolor ac finibus. Proin est sapien, tempor nec mollis ut, ultricies et
ante. Maecenas hendrerit velit non augue rutrum, mollis pharetra nisl
auctor. Ut nisl mauris, porta ut nisi ut, elementum tristique nibh. 
\clearpage
\layout
\end{document}

and its result. You see it is the same result in length we have after using option [a4paper] only with geometry:

enter image description here

So the conclusion is to use option a4paper as class option, because all other packages get noticed about this option, if it is related to them ...

Class article uses other standard margins than geometry, that's the reason for the differences you get.


geometry changes the layout (unless you use the option pass).

So there is a difference between documents with geometry and documents without geometry.

But if you load geometry it doesn't make a difference if you set a4paper with

\documentclass[a4paper]{article}
\usepackage{geometry}

or with

\documentclass{article}
\usepackage[a4paper]{geometry}

The outputs are different because geometry updates the layout (stock margins) in addition to the page size. In contrast, loading a document class like article with a4paper only changes the paper dimensions. See Default margins for geometry package.

Here's the only changes imposed by \documentclass[a4paper]{article}:

\DeclareOption{a4paper}
   {\setlength\paperheight {297mm}%
    \setlength\paperwidth  {210mm}}

I prefer to load any geometry-related settings with the package since that's what you're loading it for. That is, using the following sequence:

\usepackage{geometry}
\geometry{
  % <geometry settings>
}