$\mathbf{def}:$ let $A, B$ be sets, and $ f : A \times A \rightarrow B$ be any function. A function$ g : A \rightarrow B $ is representable by $f$ iff there is $ a \in A$ such that for all $ x \in A, g(x) = f(x, a)$.
$\mathbf{Theorem}:$ [Cantor’s Little Theorem] Let $ A, B $ be sets and $f : A × A → B$ be any function such that all functions $g : A → B$ are representable by $f$. Then every function $φ : B → B$ has a fixed point.
$\mathbf{proof}:$ Suppose that $f : A × A → B$ is such a function that all functions $g : A → B$ are representable by $f$. Let $φ : B → B$ be any function. Define a function $ψ : A → A × A$ , called Cantor’s diagonalization, by $ψ(x) = (x, x)$. Let $h = φ ◦ f ◦ ψ$;Since the function $h : A → B$ is representable by $f$ , we have an $a ∈ A$ such that for all $x ∈ A, h(x) = f(x, a)$. In particular, $h(a) = f(a, a)$. But $h(a) = φ(f(ψ(a))) = φ(f(a, a))$. Writing $f(a, a) = b$, we have $φ(b) = b$. Thus $φ$ has a fixed point, namely,$b$.
$\mathbf{Question}:$ It says Let $ A, B $ be sets and $f : A × A → B$ be any function such that $\mathbf{all}$ functions $g : A → B$ are representable by $f$.This assumption seems logically wrong to me because the cardinality of the set of all functions from $A$ to $B$ is bigger than the cardinality of $A$,so how can there exists a function $f : A × A → B$ such that $\mathbf{all}$ functions $g : A → B$ are representable by it?In the proof the assumption is applied to the function "h" (defined in the proof ).
link of the paper containing the theorem:https://mat.iitm.ac.in/home/asingh/public_html/papers/cantor.pdf
Your mistake is thinking that the cardinality of the set $B^A$ of all functions from $A$ to $B$ must be bigger than the cardinality of $A$.
For example, if $A$ is non empty and $B$ is empty, then there is no function from $A$ to $B$, so the cardinality of $B^A$ is $0$, which is less than the cardinality of $A$.
Also, if $A$ has at least two elements and $B$ has a single element $b$, then there is a unique function $f \colon A \to B$ (mapping all elements of $A$ to $b$), and so the cardinality of $B^A$ is $1$, which is less than the cardinality of $A$.