The Upper Peninsula of Michigan being part of Michigan has its origins in a territorial conflict between the State of Ohio and the then-territory of Michigan.
Discrepancies between different surveys and ambiguities in the territorial definitions laid out by Congress led to disputes over a narrow parcel of land known as the Toledo Strip. The question had laid dormant for years, but when Michigan wanted to become a state in the 1830s, it was imperative to resolve the matter in a more permanent fashion.
Accordingly, both sides began agitating the other, trying to get them to acknowledge their own claim to the region. However, neither side wanted to budge and the situation escalated until Ohio and Michigan activated their militias and prepared for war.
Yes, you heard me right. War.
Those militias got so far as marching into the disputed territory. However, the area was dominated by unforgiving terrain, and the armies got lost in the swamps and never actually had a serious engagement. There was, however, an incident involving a local lawman and somebody's knees.
Anyway, what does this have to do with the Upper Peninsula?
Washington got fed up with the spiraling situation in the disputed territory, so they decided to impose a compromise upon the "warring" parties. Ohio, having been the prior de facto controller of the Toledo Strip (and also being far more powerful politically, but when has that ever mattered to statesmen?), would retain ownership of the territory. However, Michigan would be compensated.
How? Well, across the Straits of Mackinac was a bunch of relatively unorganized territory, conveniently in the form of a peninsula that could be differentiated from land further west. Congress decided this was the perfect consolation prize and awarded it to Michigan. Sources at the time, however, joked that Congress might as well award Michigan the Moon, since there were no good access routes and the Upper Peninsula's resource wealth was not yet understood.
Thus, to this day Michigan is divided between the "Yoopers" and the "Trolls," and there are frequent but abortive attempts at splitting the state because, as OP probably guessed, it is an awkward and unnatural pairing held together by an accident of history.