They love being close to you
It’s very simple. Dogs love to sleep with their herd and the more tight they are the better. If you take your dog home, give them a good life and a lot of love, they will consider you their family. Furthermore, they consider you the leader of the herd, so will seek to sleep the closest to you.
Dogs would be willing, as often as necessary, to show their loyalty and presence. Instinctively sleeping at our feet, for them, is a demonstration of mutual protection. They feel that you are caring for them and at the same time they are taking care of you, as if you are a team in a battle. This is a very common trend in dogs and is totally normal. What happens is that our dogs do not mind if they are in a quite uncomfortable position, as long as they are as close to you as possible.