We flew into the Keflavik airport on a red eye, arriving early the next morning, & we immediately took a bus to the Blue Lagoon! Keflavik airport is about a 45 minute drive from the main city of Reykjavik, while the Blue Lagoon geothermal spa is located about 20 minutes from the airport, in the direction of Reykjavik. So it makes the most sense to either hit the Lagoon on your way in from the airport or on your way out to the airport. You can purchase tickets directly from their website & they have $5 luggage storage once you arrive.
We went in the beginning of our trip, which worked best for us, but I think if you are able to save this until your last day that is the smarter move. Everyone has a different experience hair-wise when it comes to the lagoon, but sometimes it can cause your hair to be very dry for a few days. So ladies just trust me, hit the Lagoon on your way home!