Related sci fi reading: https://en.wikipedia.org/wiki/Xeelee_Sequence
Using an asteroid or comet (of various sizes or pieces thereof) has been in science fiction stories for a long while now. Without doing actual research, I'll guess at least the 1950s, and probably a decade or three before that. There have been interesting concepts for in-system colony habitats, as well as interstellar travel. Great source of various resources.
We have, of course, vastly evolved our practical thinking on how to accomplish such a thing based upon newer science & tech.
One of my favorites, probably from the 1960s some time: Find an iron-nickle asteroid. Focus sunlight onto it with a mirror array, until it is quite hot and getting molten. Detonate an atomic bomb inside it and blow it up like a balloon. It hardens into a thick, iron-nickle shell, which can now be shaped and mined, structurally reenforced where required, other modifications. You get a large tube or semi-sphere, perhaps a mile or 5 in length/diameter. Or more. Spin it for gravity (Rendezvous With Rama, Arthur C. Clarke).
Then, park it in a Solar orbit for in-system colonization/space dock/whatever ... or attach large engines to it and send it to another star.
We can probably think of much more sophisticated ways without nuclear explosions today, but the idea was floated over half a century ago.
I wish we were far enough along as a species at this point that we could be building a few of these right now. In my lifetime I'd like to see several of these parked in permanent, colonized orbit in the Trojan Points of Jupiter, Saturn, Neptune & Uranus ... maybe even get to relocate to one of them before I died.