What was the reason for some plant and animals to become giant in course of evolution?
Thanks for asking an interesting question which made me think.

The short answer is that something evolves if there is an advantage to the genes involved, and, by 'advantage' I mean it produces more copies of the genes in the next generation so more individuals with that characteristic will be present in the population.

As to what particular advantage increased body mass had to any particular species that would depend on the particular species and its environment at the time.  There is almost certainly not a 'one-fits-all' answer. 

Most very big land mammals are herbivores and there is an advantage in having a large digestive tract when you eat a lot of plant material with a fairly low nutrient level.  However, when there are also predators around, getting big and slow might be more of a disadvantage than staying small and fast. With evolution there is often a balance of competing forces which are traded of against one another.

Where large mammals have become isolated on islands with no predators, such as a species of now-extinct elephant on the Flores Island, they tend to become smaller so this suggests avoiding predators by simply being too big for them to kill might be an important factor.

And of course with many species we have the effect of sex-selection. If females select for the biggest males, there will be a selection pressure towards greater size.

With plants it could be something else entirely. Trees, for example, have long trunks basically for one of two reasons. 

Firstly to put their leaves and seeds out of the reach of herbivores, so we have a kind of arms race like that between giraffes and acacia trees in Africa.

Secondly, when they grow in close clumps like woods and forests, there will be competition for sunlight and soil resources like water. A species which can reach higher and put it's leaves above those of it's neighbours will win the competition and there will also then be pressure on it's neighbours to evolve longer trunks.  Long trunks mean that water must be pumped a long way to the leaves so the tree with the longest trunks will also need bigger root systems.  Again a trade off between making a long trunk and dominating the water supply underground.

Many trees are also believed to have formed symbiotic associations with fungi in their root systems which help them take in the nutrients and water required to 'service' a long trunk and high-up leaf crown so they may be the only types of plants capable of doing this anyway.

One thing you might like to think about is why some whales are very big and some are relatively small (dolphins, porpoises, killer whales). What is the difference in their life-style, food, habitat, and so on, which could drive these evolutionary differences.