Since you have asked the question about
then I am sure you do want to understand the grammar in this construction. Apart from the use in questions the standard word order is subject-verb but if you start a sentence with certain words or phrases, the process of inversion ( verb - subject) takes place. In your sentence this becomes had I. The idea behind the sentence is that immediately after you had arrived home, it began to rain. You also invert the subject and verb with other similar words like hardly/sacrcely which have a similar meaning to ‘no sooner’ as in:
Hardly had I finished eating, when the phone rang
Scarcely had I finsihed talking on the phone, when someone knocked on the door.
Of your three sentences I would choose 2 as the correct one.