The one piece is a crucial missing part for an ancient weapon, a fusion reactor from the first world, and joyboy hid it from Davy Jones. Imu possesses the reactor in mariejois, but has no means to access it and get the weapon to work. Eventually, luffy will find the one piece and has to team up with blackbeard to defeat imu to be able to use it. Roger couldn't do shit with the one piece because he knew he couldn't defeat imu. Luffy and blackbeard agree to share whatever they unlock with the one piece, then blackbeard will betray luffy (he blackmails luffy by threatening to kill dragon or shanks), and combine lock and key to access the fusion reactor. However, the builders of the reactor knew about something like this happening so it will begin to self destruct and take blackbeard with it. The world is then endangered from an uncontrolled fusion reaction, so either dragon or shanks sacrifices himself to stop it by manual deactivation. The red line is destroyed in the process since the reactor is going wild in it and just melts it away, creating the all blue.
In the second world, there was a plan by Davy Jones to use said reactor to destroy Imu and everyone threatening his kingdom, but joyboy (who likely was his brother) stole the one piece and hid it on laugh tale to prevent misuse of the weapon, because he only wanted to use it for peaceful means or because he mistrusted his brother. He saved the world this way but also caused the void century and imu winning the war, which is why vegapunk wasn't sure who was right and wrong in that time.