Question: why did ursula live in the palace?
Answer: Though the two were meant to rule the seas together, Ursula's greed and use of dark magic to usurp Triton led to her being banished. The desire for revenge and power is her motivation for the show.