Monaco is a small country bordering France, with the distance between the two countries being so small that you could come in from either without even feeling like you had left the same street.
Before Ligue 1 became as polished and reputable as it is now, French football was a lot looser and more pragmatic. Monaco, sharing a border with France and lacking a league of its own, asked to be allowed in. The French Federation agreed with the request (I think it's similar to how clubs like Cardiff, Swansea, Wrexham, etc. play in the English leagues), hence AS Monaco became a part of Ligue 1 and French football.
The part of France that bordered Monaco happened to be Nice, and as such a rivalry developed between the two clubs playing in that region, a derby that is now one of the fiercest rivalries in French football.
