Why are the length of day and year on earth different to other planets?

The length of the year is determined by the planet's solar orbit. The further out the orbit, the longer the year.

Lengths of days are determined by rotational velocity. Mercury is locked in a tidal resonance with the sun, which governs the length of its day (a particular fraction of the length of its year). Venus barely rotates, so the length of its day is 243 times that of ours. The day on Mars is almost as long as ours, in fact just a little bit longer. Jupiter, big as it is, rotates very fast, about once every 10 hours. So its day is less than half the length of ours.