Question: how did joffrey become king?
Answer: Joffrey Baratheon became King after Robert Baratheon died of injuries sustained during a wild boar hunt. Joffrey and his mother Cersei ignored Ned Stark's protests that Robert had made him Regent and had him arrested instead. Joffrey also ordered the arrest of Sansa and Arya Stark but Arya managed to escape.