Right offhand, without asking a lot of questions, my guess would be that the problem was the potting mix. Most herbs do best in a mix with a higher pH, around 6 to 7.5, and most potting mixes are more acidic than that.
Container-grown plants require a potting medium that drains rapidly, so if you mixed a lot of compost into your soil, or perhaps began with garden soil, then the drainage was likely insufficient. With poorly draining soil in a container, the top will dry to the point of looking like a desert, but the soil in the bottom 1/3 of the container will remain waterlogged.
IMO, poor drainage and wrong pH are the cause of the most common problems people have when they begin to explore container gardening. I know because I made the very same mistakes myself.
Sunlight coming through a window is about the same intensity as medium-deep shade outdoors. In addition, plants that are placed close enough to the glass to benefit from the sunlight will also be exposed to heat, because some of the light energy is converted to heat energy as it passes through the glass. Supplemental light is almost always necessary, in order to provide not only sufficient intensity of the light, but also to provide the appropriate 'day length', I.e. the number of hours of bright light the plant receives each day. Six hours of very bright light is considered "full sun", which is what most plants need to thrive. Greens like spinach and lettuce can get by with slightly fewer hours, but they don't tolerate heat well.