There's plenty of reasons why they might be much further ahead in tech than you, but the main thing is they're simply producing more research than you. Many people think if they get a library in their city they should be able to keep up with tech, but I'd focus more on expanding rather than building a library in the early game. The more cities you have, the more research you're able to perform. Then once you have several cities, you need to specialize your cities. Not every city needs a library, a barracks, or a market. Decide whether you want the city to be a science city, a gold city, or a military city, and then build the appropriate buildings for it. Cities with a lot of hills nearby will be a better military city, while cities with a lot of coast nearby will be a better gold or science city. There's no reason to ever build both a library and a market in the same city. That's a waste of hammers because you will only be able to generate gold or science in the city, not both at the same time. Likewise, it's a waste of a GP if you settle a Great Explorer and a Great Scientist in the same city; the merchant should go in the gold city and the scientist in the science city. The same thing goes for wonders too; you don't want to build the Trade Fair of Troyes in a science city. The main thing in all Civilization games that newbies often fail to understand is the need to specialize their cities.
(By the way, I apologize if it was me who attacked you with a tank army in 1300
)