Which of the following sentences is correct, and why?
I bought a house in the outskirts of the city.
I bought a house on the outskirts of the city.
As Martha's NGram shows, on the outskirts is the prevailing choice between the two.
Why should this be? Well IMO it is down to people's underlying understanding of what the phrase means. You know what the outskirts are, even if you don't know why.
Here's a short etymology for outskirt from Etymonline
"outer border," 1590s, from out + skirt (q.v.). Now only in plural. Originally in Spenser.
and in this instance skirt means a border or edge. If you live on the outskirts you live on the outer edge. You can't live in an edge.
So while it's not wrong to say in the outskirts, since these days it pertains to an area rather than an edge, the underlying meaning of the phrase has persisted in our psyches (according to Martha's NGram) and so we prefer that one overall.