Accuracy is a measure of how well the predictions correspond with the true categories after you apply some rule to the raw output to convert those values into hard classifications. The most common of these rules is to take the category that has the highest predicted probability, which corresponds to assigning to category $0$ if the prediction is below $0.5$ and to category $1$ if the prediction is above $0.5$. (For the rare case of having a prediction of exactly $0.5$, perhaps randomize in some way. This could be a discussion of its own.)
(This gets messier if you do not predict on $[0,1]$, but the idea remains that you pick a threshold where predictions below are assigned to one category and predictions above are assigned to the other.)
AUC is strictly a measure of ability to discriminate between the categories and has no regard for calibration (if events predicted to happen with probability $p$ really do happen with probability $p$). In fact, dividing every prediction by two does not change the AUC, which I demonstrate below with the exact same code I used in an answer I posted a few minutes ago that might be of interest.
library(pROC)
set.seed(2023)
N <- 1000
p <- rbeta(N, 1, 1)
y <- rbinom(N, 1, p)
pROC::roc(y, p)$auc # I get 0.8481
pROC::roc(y, p/2)$auc # Again, I get 0.8481
The p
and p/2
cannot both be calibrated, unless p
is always zero and the event never occurs.
Finally, the log-loss measures both prediction prediction and the ability of the model to discriminate between the categories.
Overall, these three statistics (accuracy, AUC, log-loss) measure totally different aspects of the model in different ways. There is no reason to expect the three to agree on the best model, and what constitutes the best model for your work will depend on what you value and why you bother to do any modeling at all. If you need a model that tends to make good decisions when you apply a threshold (such as in software that lacks a human in the loop), maybe optimizing accuracy will be good for you (though I would advise giving thought to whether or not a threshold of $0.5$ is appropriate for your task). If you need to put the predictions in the correct order but otherwise do not care what the predictions are, AUC could be your friend. If you value having accurate probabilities, then a strictly proper scoring rule like log-loss or Brier score could be your performance metric of interest.