Suppose $A,B \in \mathbb{R}^{n \times n}$, $f: \mathbb{R}^{n \times n} \to \mathbb{R}$. Define $\nabla_A f(A)) \in \mathbb{R}^{n \times n}$, where $(\nabla_A f(A))_{ij} = \frac{\partial{f(A)}}{\partial{A_{ij}}} $. Consider the equation $\nabla_A \text{tr}AB = B^T$, according to this note. This can be proved as $$ \begin{align} f(A) = \text{tr}AB &=\sum_{i=1}^nA_{1i}B_{i1} +\sum_{i=1}^nA_{2i}B_{i2} + \cdots + \sum_{i=1}^nA_{ni}B_{in} \\ &= \sum_{j=1}^{n}\sum_{i=1}^{n} A_{ji}B_{ij}\\ \end{align} $$
If we assume A is symmetric matrix, I'm confused whether the following is right because it contradicts with $\nabla_A \text{tr}AB = B^T$.
$\nabla_A \text{tr}AB = B + B^T$ because $A_{ij} = A_{ji}$ and $\frac{\partial{f(A)}}{\partial{A_{ij}}} = B_{ij} + B_{ji}$
The function $$ f : \mathbb{R}^{n\times n} \rightarrow \mathbb{R}, \qquad A \mapsto f(A) , \quad A \in \mathbb{R}^{n \times n} $$ can regarded as multivariable function of $n^2$ coordinates $A_{ij}$. Partial derivative $\frac{\partial f(A)}{\partial A_{ij}}$ defined as $$ \frac{\partial f(A)}{\partial A_{ij}} := \lim_{h \rightarrow 0}\frac{f(A_{11},\cdots A_{ij}+h, \cdots ,A_{nn}) - f(A_{11},\cdots, A_{ij}, \cdots ,A_{nn})}{h}. $$ When you take the derivative of the function $f(A) = \sum A_{ij}B_{ji}$ (regard $A_{ij}$'s as the variables) and evaluate the derivatives for a point $A$ s.t $A_{ij}=A_{ji}$, you'll have (for example $2\times 2$ matrix),
\begin{align} &\lim_{h \rightarrow 0}\frac{(A_{11}B_{11}+ (A_{12}+h)B_{21} + A_{21}B_{12}+ A_{22}B_{22})-(A_{11}B_{11}+ A_{12}B_{21} + A_{21}B_{12}+ A_{22}B_{22})}{h} \\ &= \lim_{h \rightarrow 0}\frac{(A_{11}B_{11}+ (A_{12}+h)B_{21} + \color{red}{A_{12}}B_{12}+ A_{22}B_{22})-(A_{11}B_{11}+ A_{12}B_{21} + \color{red}{A_{12}}B_{12}+ A_{22}B_{22})}{h}\\ &=B_{21} \end{align}
whereas $\frac{\partial f(A)}{\partial A_{21}} = B_{12}$. We see that the condition of being symmetric $A_{ij}=A_{ji}$ will not affect the evaluation of the limit. Your confusion before, that $$ \frac{\partial f(A)}{\partial A_{ij}} = \frac{\partial}{\partial A_{ij}} (\sum_{i,j=1}^{n} A_{ij}B_{ji}) = \frac{\partial}{\partial A_{ij}}(\cdots + A_{ij}B_{ji} + \cdots + A_{ji}B_{ji} + \cdots) = \frac{\partial}{\partial A_{ij}} (\cdots + A_{ij}(B_{ij}+B_{ji}) + \cdots) = B_{ij}+B_{ji} $$ is because you treat $A_{ji}$ as a varying variable by the substitution $A_{ji} = A_{ij}$.