It mutated its way from affecting bats to affecting people. Fortunately, the vast, vast majority of mutations either do nothing or make things actively worse.
https://qbrc.swmed.edu/projects/2019ncov_immuneviewer/
That's the chain of mutations for SARS-Cov-2 they've seen so far.