I find a notation such as "f²(x)" ambiguous; I know that it's traditional for the trigonometric functions, but I believe that
f(x)²
is far less ambiguous, when we agree that "f(x)" has precedence over other algebraic expressions.
However, here it is.
\documentclass{article}
\makeatletter
\newcommand{\fx}[1]{\def\buergi@arg{#1}\@ifnextchar^\buergi@fexp{f(#1)}}
\def\buergi@fexp^#1{f^{#1}(\buergi@arg)}
\makeatother
\begin{document}
$\fx{x}\quad\fx{x}^2$
\end{document}
You carry over the argument and test whether the argument is followed by ^; in this case you typeset f^{<exponent>}(<argument of \fx>), otherwise you do the simple thing.
A more general macro might be
\documentclass{article}
\makeatletter
\newcommand{\fx}[2][f]{%
\def\buergi@arg{#2}%
\@ifnextchar^{\buergi@fexp{#1}}{#1(#2)}}
\def\buergi@fexp#1^#2{#1^{#2}(\buergi@arg)}
\makeatother
\begin{document}
$\fx{x}\quad\fx{x}^2$
$\fx[g]{x}\quad\fx[g]{x}^2$
\end{document}
which gives

f^*(x)or\Psi^\dagger(x)etc. – buergi Nov 20 '12 at 18:30