It fits quite well. In particular, many of our formalisms are used (if altered) all over machine learning. Having training as a physicist gives you a wide range of analytical skills.
I’ve seen former physicists doing everything from clinical pediatric cancer or bioinformatics to do chip design, financial work, and ML.