Robust and accurate attitude and heading estimation using Micro-Electromechanical System (MEMS) Inertial Measurement Units (IMU) is the most crucial technique that determines the accuracy of various downstream applications, especially pedestrian dead reckoning (PDR), human motion tracking, and Micro Aerial Vehicles (MAVs). However, the accuracy of the Attitude and Heading Reference System (AHRS) is often compromised by the noisy nature of low-cost MEMS-IMUs, dynamic motion-induced large external acceleration, and ubiquitous magnetic disturbance. To address these challenges, we propose a novel data-driven IMU calibration model that employs Temporal Convolutional Networks (TCNs) to model random errors and disturbance terms, providing denoised sensor data. For sensor fusion, we use an open-loop and decoupled version of the Extended Complementary Filter (ECF) to provide accurate and robust attitude estimation. Our proposed method is systematically evaluated using three public datasets, TUM VI, EuRoC MAV, and OxIOD, with different IMU devices, hardware platforms, motion modes, and environmental conditions; and it outperforms the advanced baseline data-driven methods and complementary filter on two metrics, namely absolute attitude error and absolute yaw error, by more than 23.4% and 23.9%. The generalization experiment results demonstrate the robustness of our model on different devices and using patterns.