First of all, doing \let\foo\textit is wrong, see When to use \LetLtxMacro?.
With an up-to-date LaTeX you should do
\NewCommandCopy{\foo}{\textit}
or \LetLtxMacro instead of \NewCommandCopy if you're stuck with an outdated version.
But that's not sufficient. Indeed, in hyperref.sty you find
346 \def\pdfstringdef#1#2{%
347 \begingroup
[...]
403 \let\emph\@firstofone
404 \let\textnormal\@firstofone
405 \let\textrm\@firstofone
406 \let\textsf\@firstofone
407 \let\texttt\@firstofone
408 \let\textbf\@firstofone
409 \let\textmd\@firstofone
410 \let\textit\@firstofone
411 \let\textsc\@firstofone
412 \let\textsl\@firstofone
413 \let\textup\@firstofone
[...]
so \textit is added to the “bookmark exceptions”, which your \foo command isn't.
If you want to alias the command, you need to add it to the exception list.
\NewCommandCopy{\foo}{\textit}
\makeatletter
\pdfstringdefDisableCommands{\let\foo\@firstofone}
\makeatother
Full example.
\documentclass{article}
\usepackage{hyperref}
\NewCommandCopy{\foo}{\textit}
\makeatletter
\pdfstringdefDisableCommands{\let\foo@firstofone}
\makeatother
\begin{document}
\section{Command \foo{aliasing}}
Here I use \texttt{\textbackslash foo} to
\foo{to typeset this in italic}.
\end{document}

hyperref’s source code. Could you please also provide some explanation why doing\let\foo\textitis wrong? – bp99 Apr 09 '22 at 10:56