This is something that palaeontologists still debate. Many even try to stay away from the topic all together. Some believed the gravity was different in prehistoric earth but we are now learning that it was the same as today. Some believed it was higher oxygen levels but many scientists are now saying that the oxygen levels were actually lower than present. There have been more recent findings that many dinosaurs had air sacs (such as sauropods and theropods)...helping them carry their gigantic size and maintain their circulation/respiration. Many breathed like today’s birds. These dinosaurs had more hollow bones/air sacs than others – this also decreased their weight (and could easily increase their neck length, like the sauropods). We are finding more and more that large dinosaurs probably did not weigh as much as we first thought – and grew faster than was previously theorized.
There are many factors at play in how a dinosaur would/could become so large. Here are 3 theories explaining some of the main ideas with out getting too scientific. Here is an article on sauropods and gigantism… a little more in depth. If you want an even more in depth article, here is one about the evolution of gigantism through the biology of sauropods (a very long read).
I hope I helped a bit… I’m a bit loopy from codeine pills (I injured my neck last night).