With an up-to-date LaTeX (released 2020-10-01 or later) you can do it in the document preamble:
\documentclass{article}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}
\AddToHook{cmd/appendix/before}{%
\setcounter{equation}{0}%
\renewcommand{\theequation}{\thesection.\arabic{equation}}%
\setcounter{theorem}{0}%
\renewcommand{\thetheorem}{\thesection.\arabic{theorem}}%
}
\begin{document}
\section{Text section}
Some text.
\begin{theorem}
Pigs can fly.
\end{theorem}
An equation
\begin{equation}
1+1=2
\end{equation}
\appendix
\section{Appendix section}
Some text.
\begin{theorem}
Pigs cannot fly.
\end{theorem}
An equation
\begin{equation}
1+1=2
\end{equation}
\end{document}

With an older LaTeX, you can do it by moving the code after \appendix
\documentclass{article}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}
\begin{document}
\section{Text section}
Some text.
\begin{theorem}
Pigs can fly.
\end{theorem}
An equation
\begin{equation}
1+1=2
\end{equation}
\appendix
\setcounter{equation}{0}
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\setcounter{theorem}{0}
\renewcommand{\thetheorem}{\thesection.\arabic{theorem}}
\section{Appendix section}
Some text.
\begin{theorem}
Pigs cannot fly.
\end{theorem}
An equation
\begin{equation}
1+1=2
\end{equation}
\end{document}