Hi Carmel,
They're totally different cars. The Corolla is a C-segment saloon, so its rivals are the likes of the Ford Focus saloon, the Volkswagen Jetta and the Skoda Octavia. It's as solid and reliable a car as you can buy, comfy, roomy and decent to drive. Standard equipment could be a bit better, but the best engine by far is the new 1.2 petrol turbo.
The i40 is much bigger and a rival to the Ford Mondeo, Volkswage Passat and Toyota Avensis. It's really well made and hugely spacious and comfy. The 1.7 diesel is a good engine and very economical but it's not as sweet to drive as the Mondeo or the Mazda6. Best sampled as a Tourer estate.