Yes, the Titanic was a real ship and its sinking is a historical fact. The RMS Titanic sank on its maiden voyage on April 15, 1912, after striking an iceberg.
While James Cameron's 1997 film Titanic fictionalized the central romance (Jack and Rose), the disaster, the ship's specifications, and many secondary characters (Captain Smith, Thomas Andrews, Molly Brown) are historically accurate.