Luigi's mansion is the result of a contest he never entered. He wins it by accident — a letter arrives informing him that he has been selected as the winner, and the prize is a house.
The catch, of course, is that the mansion is packed with ghosts, and the reason Luigi was chosen in the first place is that someone needed a new ghostbuster. Mario goes missing inside, which gives Luigi both motive and a job.
It is a neat setup for Luigi's haunted-house adventure: he gets a home and a quest in the same envelope, and neither turns out to be quite what he expected.