Good question. (I wouldn't endorse the links you cited in your question or in your first comment.)
There is good information at https://stats.stackexchange.com/a/86722/162986, as @user162986 pointed out. If you are looking for a more intuitive, introductory account, read on.
Either logistic regression or log-linear analysis might be used when all variables are categorical. But it's not true that the latter method is globally preferred.
The two methods answer different types of questions. With logistic regression one identifies, and analyzes relationships with, a single dependent variable (response variable, outcome variable, 'Y'). One might develop a predictive equation for Y based on one or more predictors. In connection with this one might classify each observation as taking one value or another with respect to Y. Alternatively, one might attempt to assess the strength of each predictor in causing Y -- as risky as this is.
With log-linear analysis one treats no single variable as dependent but instead assesses what if any patterns of relationships emerge tying together three or more variables. In this sense log-linear analysis superficially shares something with principal components analysis and exploratory factor analysis. However, a key difference from these data reduction techniques is that log-linear analysis incorporates a statistical significance test of the relationship linking the three or more variables.
It's fair to say that log-linear analysis is "an extension of the chi-square test." Let's ask not so much "why" this would be a good thing, but "when": when we want to know the same thing about three or more variables that we would be seeking via a chi-square test of independence of two -- namely, to what degree they are (in)dependent.