Lots of reasons. It was at the time the least authoritarian regime. The alternatives are Saudi-Arabia, where as I understand the gas is harvested with the help of human rights violations, and other nearby suppliers like Norway were already and still are at capacity.
At the same time, gas is a relatively enviromentally safe, when compared to others, and since the relations to Russia were mostly friendly, the slight problems in the regime were ignored.
Now germany is reliant on them, and that was a mistake they are realizing. But if germany stops accepting gas today, the germans will freeze in the winter when the gas runs out, so its a complicated situation.
At the same time, gas is a relatively enviromentally safe, when compared to others, and since the relations to Russia were mostly friendly, the slight problems in the regime were ignored.
Now germany is reliant on them, and that was a mistake they are realizing. But if germany stops accepting gas today, the germans will freeze in the winter when the gas runs out, so its a complicated situation.