Craignethan Castle was built by Sir James Hamilton, with work starting in 1531. Sir James was a friend of King James V and as a result had access to some of the best master masons in Scotland. This likely helped Craignethan's design and construction.
In 1540, Sir James was no longer such a good friend of the royal family as he was accused of treason and executed, the crown taking possession of the castle as a result.
Mary Queen of Scots stayed here briefly as a guest of Lord Claud Homilton after her escape from Loch Leven Castle. Hamilton then led Mary's forces into battle at Langside. After their defeat the castle was taken by Moray as Regent.
An the 17th century the Covenanter Andrew Hay bought the castle. In 1665 he had a house built in the southwest corner of the courtyard.
Tradition has it that Craignethan was the inspiration for Tillietudlem Castle in Sir Walter Scott's novel Old Mortality. Scott explicitly denied this to be the case, but tradition is a hard thing to shake off!