My naive (and likely wrong) understanding is that cosmological inflation was caused by a "false vacuum" of the higgs field. Think of it as if the energy pressure of a system is higher than a vacuum, but has similar pressure properties of a vacuum. That had the effect of gravitational pressure pushing matter outwardly, instead of pulling it inwardly like we have it today (to answer your question). That caused enormously fast expansion of the universe. Very shortly afterwards, the false vacuum "decayed", and gravity started behaving as you know it.
Check out Alan Guth's inflationary universe - a surprisingly accessible book on a deeply complex subject.
Someone please correct me where I'm wrong!