You can get to Windsor in circa 40 mins via the new Purple Line/Elizabeth line / Crossrail (3 names for the same thing)
You change at Hayes and then at Slough for a shuttle train to Windsor. The dining options in the town are not great (sadly aimed at tourists) so the recently opened Ivy brasserie is the best bet.
You then have the option of the castle, a lovely walk by the river thames and visiting Eton college (famous private school in the UK) which has beautiful buildings and grounds.
If feeling adventurous, you can get a taxi back to LHR via these two amazing pubs for lunch / early dinner
The Loch & The Tyne by Adam Handling Old Windsor
or
The Bailiwick - Free House
alternatively, you could go to Virginia waters / Saville gardens and enjoy one of the most beuatiful public parks in the area. Its a lovely walk and joins upto Windsor great park (so lots of different routes and options).
Nearby is the new
https://www.fairmont-windsorpark.com/ fairmont hotel - afternoon tea or cocktails
Anyway, have fun