The dinosaurs, mammoths, giant plants etc are known to be bigger than modern animals. I wonder why they had been lived and why they are not living now? I really don't know much but is it something about oxygen balance or something similar?
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.
to expand on Rose's answer, certain environmental factors are what people cite with unusual size changes in an animal over time as it diversifies into new species.
Gigantism (and dwarfism) on islands are a particular example. In this case an animal may arrive on an island and some of the predators or competitors that it is used to will not be there. Then a single species will spin off many species, each one will fill one of the niches that are unfilled on the island - eating bugs from bark, breaking open nuts. The lack of large carnivores will allow a nice juicy herbivore to get larger without fear of being eaten. Similarly the Moa was a bird that became an aggressive carnivore in its island habitat, where it's very rare to see an aggressive land bird when a big cat or other carnivore is already present. Such large changes in environment can also result in dwarfism - smaller species as smaller animals like squirrels or mice might not be present to consume all the food that are available. The Hobbits recently discovered in Indonesia are an example of island dwarfism.
That being said, selective pressure can probably make many animals larger or smaller - lots of the dog breeds are smaller than wolves that they descended from. I think steers are as large as we can make them and are larger than native cattle stock.
As far as the environment that caused dinosaurs to be so large, the higher levels of oxygen on the planet at the time is a common theory for why they were so large. I also think that at least early on, the selection conditions that favored larger animals were probably put in place as animals evolved without any competitors whatsoever (first animals on land or sea). If this were to happen again, its not clear whether dinosaurs would have been so large - perhaps we could have had gigantic mammals or descendants of trilobites.
One significant point not considered in previous answers is the reproductive rate and environmental variability. Larger animals have longer times between generations and generally reproduce less rapidly. In a less stable environment, more rapid reproduction allows more rapidly adapting population to the availability of resources, providing a larger population so that random events are less likely to eliminate the entire species (genetic variation can be a factor here), and minimizes the absolute amount of resources needed for a stable population.
There are significant benefits to being larger. In addition to interactions with other animals, a larger animal has lower surface area to mass ratio and so will lose less heat per unit mass (which might have been significant for ice-age mammals?). A larger animal can also support larger organs (not just digestive tract as mentioned by Rosa Rubicondior, large brains would not be possible in small animals) or substantial-sized specialized features (where utility is not a linear function of size).
It needs to be recognized that this is an outstanding question in biology, i.e., there is no certain answer.
This review considers the various theoretical and empirical evidence for phenotypic selection on body size:
Some have hypothesized a connection between body size and the evolution of endothermy:
And others have suggested a link to oxygen in the atmosphere:
And I'll throw this hypothesis into the ring. The large dinosaurs only went extinct 65 million years ago. That's basically yesterday in terms of the geological time scales across which body size may evolve - they (dinosaurs) originally evolved 230 million years ago. That means we've got at least 165 million years to go before you can see if our current diversity of life on earth can evolve similarly large organisms!