To add to TMKB's answer:
Logistic regression is used for either prediction or analysis of relationships between variables. If the goal is the latter, the main difference between Pearson's chi-squared test and logistic regression usually lies in two aspects:
- Choice of statistical test (which determines the p-value of the regression coefficient) for the logistic regression - the options are: Wald, likelihood ratio and score test (the latter is rarely used in practice, but in fact it seems to be equivalent to the classic chi-squared test)
- Corrections that are applied (if any) - often, for chi-squared tests a continuity correction (Yates) is applied
If you choose the score test for logistic regression and do not apply a continuity correction for the chi-squared test, the results of chi-squared and logistic regression will be identical. For more information, take a look at this very(!) helpful answer by gung: Why do my p-values differ between logistic regression output, chi-squared test, and the confidence interval for the OR?
When applying Fisher's exact test, however, you condition on the margins (as pointed out by @Scortchi in the comments). Doing so implies the somewhat strange assumption that you know the true margins although this is usually not the case. Since in most practical situations these margins are not fixed by design, there are good arguments to not use Fisher's exact test. For reference, see Lydersen et al. 2009, Stat. Med., 28 (7), "Recommended tests for association in 2×2 tables" (link).
In conclusion: chi-squared test and logistic regression should lead to similar results or even identical, if you specify them as required. In some situations, logistic regression might provide you with an advanced tool kit since you can choose different tests which might lead to a gain in power in some situations. However, if you do not have a clear reasoning to choose either Wald or likelihood ratio and you actually simply want to analyze the relation between two binary variables, performing a logistic regression might be considered as overcomplication when you could instead simply perform a chi-squared test.