Le problème pourrait venir de l'utilisation de \pgfmathdeclarefunction. En effet j'ai simplifié l'exemple.
Mon problème peut être mieux compris en mettant en commentaire, alternativement les lignes 32 et 33 (celles qui utilisent addplot). La ligne qui n'utilise pas la fonction déclarée fonctionne correctement. Celle qui utilise \pgfmathdeclarefunction décale le graphique à droite.
\documentclass{article}
\usepackage[french]{babel}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{babel, math}
\pgfplotsset{compat=1.18}
\usepackage{siunitx}
%
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
xlabel={Fréquence $\omega$ [\si{\radian\per\second}]},
ylabel={Gain en dB},
xmode=log,
ymode=linear,
grid=both,
minor grid style={gray!25},
major grid style={gray!50},
xmin=100, xmax=10000,
ymin=-10, ymax=100,
width=\textwidth, height=6cm,
% xticklabels=\empty,
legend pos=north west,
]
%
\pgfmathdeclarefunction{GaindB}{1}{
\pgfmathparse{20*log10(#1)}
}
%
\addplot[blue, line width=1.5pt, domain=100:10000, samples=100]({x}, {GaindB(x)});
\addplot[blue, line width=1.5pt, domain=100:10000, samples=100]({x}, {20*log10(x)});
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}