• Because the UK (and the US and Russia) agreed to protect Ukrainian sovereignty after Ukraine willingly had the Soviet nuclear arsenal dismantled after the Soviet Union dissolved.

    In 1994, Ukraine agreed to transfer these weapons to Russia for dismantlement and became a party to the Treaty on the Non-Proliferation of Nuclear Weapons, in exchange for economic compensation and assurances from Russia, the United States and the United Kingdom to respect Ukrainian independence and sovereignty within its existing borders.

    See https://en.wikipedia.org/wiki/Ukraine_and_weapons_of_mass_destruction

    The other reason is basically the same reason why the UK got involved on the side of Poland in 1939.