Once upon a time, the Kensington Palace as we know it today was a suburban villa in Nottingham known as the Nottingham House.
In 1689 King William III and Queen Mary II bought this house as the king suffered from asthma and needed to move away from the Whitehall Palace to a place with cleaner air. Hence, the Nottingham House was bought from the Earl of Nottingham as a country retreat to occasionally escape the dank air of London but stay close to the courtly affairs.
After William III died in 1702, the palace became the home of Queen Anne, sister to Queen Mary. Sir Christopher Wren designed the Orangery and Henry Wise designed a large garden for Queen Anne during the period she stayed. Queen Victoria is said to have most of her childhood at the Palace before she left for Buckingham Palace in 1837. In modern times, the Kensington Palace was known as the London residence of Diana, Princess of Wales.
The palace opened to the curious public in 1899, a few years before Queen Victoria's death. It immediately became the home of the London Museum before the museum moved to its current Barbican headquarters. Today it continues to serve as a residence to several members of the Royal Family. In 2012, the latest renovation to Kensington Palace was undertaken which took a period of 2 years to completion and a total of £12 million.
If you're further interested in the history of Kensington Palace, here's a detailed timeline.