Here's how it works:
"There is/are"
* Il y a un chat dans le jardin. (There is a cat in the garden.)
* Il y a des livres sur la table. (There are books on the table.)
"Ago"
* Il y a deux ans, j'ai déménagé. (Two years ago, I moved.)
* Il y a une heure, j'ai mangé. (An hour ago, I ate.)
Essentially, "il y a" acts as a placeholder for something that exists or happened in the past. The following word (or phrase) will determine the exact meaning.