What is the purpose of doing a logistic regression when the predictor is dichotomous? I would like to expand on this question. Knowing that it is possible to do a logistic regression when the IV is dichotomous, and that I've seen it done in studies: what is the purpose of doing so, and what would be the advantages over using the usual Pearson X-square or (if a non-categorical version of the predictor is available) a simple t-test?
 A: In terms of fit to the data, any GLM will give equivalent fit in a binary-binary situation. So if you do the regression and check the predicted probabilities, they'll all be the same regardless of which GLM or link function you use. See page 175 of Wacholder (1986) below.
Pearson $\chi^2$ test (without continuity correction) will be equivalent to Rao's score test of the logistic regression model, so they are practically equivalent. And the G test is equivalent to the likelihood ratio rest from the logistic regression. The default test in most packages is a Wald test.
A linear regression or t-test may be faulty because binary data implies heteroskedasticity on the scale of the binary response. So Welch's t-test might actually be acceptable for inference.
The t-test will give the simplest interpretation. The mean difference is the difference in probabilities between the two groups.
UPDATE
As @AdamO pointed out in the comments, you can also do a GLM with binomial distribution and identity link function. Sometimes, this model will not converge in software but it definitely will when the lone predictor is dichotomous. This has the advantage of estimating the correct mean difference with an adequate variance structure. If you perform the score test, the inference will again be no different from logistic regression.

SHOLOM WACHOLDER; BINOMIAL REGRESSION IN GLIM: ESTIMATING RISK RATIOS AND RISK DIFFERENCES, American Journal of Epidemiology, Volume 123, Issue 1, 1 January 1986, Pages 174–184, https://doi.org/10.1093/oxfordjournals.aje.a114212
