Different life forms have different numbers of chromosomes for several reasons, but first I must tell you the reason why they exist in the first place.
The vast majority of the time, DNA is not in chromosome form. While DNA is not is chromosome form, it is contained within the nucleus of the cell, doing normal DNA stuff such as coding for proteins. (technically coding for mRNA, which codes for proteins)
Chromosomes become very useful when the cell starts to divide in a process called mitosis. During mitosis, the nuclear membrane (the boundary holding the DNA inside of the nucleus) must dissolve. The DNA must them be manipulated so that the correct strands of DNA end up in the right parts of the cell, so that the new daughter cells have the right DNA. If DNA was in its normal form, it would nearly impossible to control, since it would just get all over the place inside of the cell.
Turning the DNA into a chromosome fixes this problem by causing it to be much more compact in an easy-to-move package. During mitosis, the chromosome can be split right down the middle, ensuring that both daughter cells have the right amount of DNA.
Chromosomes also come in very useful during meiosis, which is the production of sex cells. In order to make sure that your children are genetically different from any other life form, your cells much be able to mix-and-match various genes. To ensure that the correct parts of the DNA are swapped (and so that your children aren’t missing a gene), the chromosome allows the easy manipulation of DNA.
————————-
As for why different species have different numbers, there are many factors:
How many spare copies do you need? Plants have hundreds to thousands of chromosomes because they are constantly getting sunburned, which destroys DNA (as proof of how it can damage DNA, sunburn can cause melanoma).
How much DNA do you need? Fruit flies can have fewer chromosomes because they aren’t as complex and don’t need those many spare copies.
How much DNA do you have, but only used to need? A large percentage of DNA that humans have is now junk DNA that was used at one point in evolution. We don’t need it, but we still carry it around because it is hard to get rid of.