Is it bad luck or bad genes that made me develop liver spots?

Neither. Liver spots are no big deal. They are caused primarily by prolonged sun exposure. I suppose you could make a case for "bad genes", since fair-skinned people are more prone to get them. But there is nothing "bad" about them; they are a mark of maturity.
Neither. It is sun exposure, and the fact that you have lived long enough to develop them. Liver spots are a "mark of maturity", and while they are cosmetically unacceptable to some people, they are of no concern unless they itch, bleed, or change color abruptly.