What determines the kind of genes an organism possesses?

What determines the kind of genes an organism possesses?