Why does a gene have two alleles? When there is a gene for producing the color pigment for a flower, why are there there two alleles, producing either same color or different color (homozygous and heterozygous)?
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Allele is a variant form of a gene. How many alleles there are depends on number of copies of the gene and number of variants. In theory you can have 5 identical copies or single copy and single allele (Y-linked genes come to mind).
Regulation is very complicated, I'll refer you to reading on recessiveness, dominance. Barr bodies also have to do with various expression profiles in same thing.
A flower (or a person) has two alleles for a gene because it inherits one set of chromosomes from one parent and another, comparable, set of chromosomes from the other parent. Hence there are two copies of each gene, and so there are two alleles for each gene.