F1Krazy's answer is very good and deserves its upvotes, but it does seem to miss the crux of your confusion.
Your reasoning is
- Bloomberg's declared goal is to prevent Trump's reëlection.
- He could've run in either party's primary
- and
- Running in the Democratic primary leaves Trump assured of the Republican nomination and contributes to Democratic disunity.
- Running in the Republican primary would have contributed to Republican disunity and wouldn't have impeded the eventual Democratic nominee any more than necessary.
- Therefore, he should have run in the Republican primary.
I don't think F1Krazy's answer is really persuasive to you because you don't care if Bloomberg wins anything and it's clearly better for Team Anti-Trump if he mucks up the Republican process and stays the hell out of the Dems' way.
What you're missing is that Bloomberg's declared goal is patently not his actual goal. Bloomberg is not in this to remove Trump but to (ideally) win himself and (at minimum) hinder even worse* candidates like Sanders.
*From the point of billionaire technocrats like Bloomberg...
This is clear because Bloomberg never had to enter either primary: he could have just bankrolled PACs and moderate Democratic candidates. (For the reasons mentioned by F1Krazy, it would have probably been counterproductive to fund any Republican challenge: the inevitable steamrolling of such a challenge would have just boosted Trump's image and energized his base, the opposite of what the Dems need.)
Bloomberg didn't enter the race until late November, forced into an unprecidented media buy to make up for his abandonment of the early states, because up til then he'd been mostly fine with the inevitability of Biden winning the nomination. As Biden's polls collapsed in Iowa, Warren surged nationally, and Sanders held his own, Bloomberg saw that Bernie or someone similar could cruise to the nomination. The entire rationale of Bloomberg's Democratic primary campaign is not to defeat Trump at all costs but to (ideally) defeat Trump by (definitely) denying Sanders (or at the time of his announcement Warren) the ability to win the nomination on the first ballot. Once the second ballot opens up the race, he hopes to use the masses of goodwill his money has bought among the Democratic Party establishment to get the nomination or, at the very least, to assure Biden or a Biden-like compromise wins out.
If you want to be very kind to Bloomberg, you can imagine that all comes from a very sincere belief that Trump would crush Bernie and Bernie would crush the Dems' chances of taking control of Congress. Plenty of establishment Dems really do believe that. (Witness MSNBC's various meltdowns after Nevada, when Sanders proved his support among union members and the hispanic community.)
If you want to be less kind, you can take your pick between Bloomberg dreading an America in Sanders's image worse than four more years of Trump or Bloomberg being old and thinking this is his last best chance to win the presidency himself.
In any case, Bloomberg is patently not making choices that benefit Team Anti-Trump as a whole and, along with his execrable debate performances, that seems to have been noticed, with his net favorability among his new party at around -10%. You still can't ignore all the goodwill among the Democratic Party that his years of heavy financing have provided: if he doesn't completely collapse in the states he's heavily advertized in, he's a strong contender for winning a contested convention both as a form of payback and out of hope for lucrative positions in and around his administration.