X at Y means X is a place, and Y is close enough to X that if we wanted to find Y, we'd first have to find X. A place is large amount of space where things can be built or where things can happen.
X in Y means X surrounds Y, either physically or logically.
Buildings surround you, so when you enter a building, you are said to be in it, and can say you work in a building.
Businesses sometimes aren't just a building or room in a building, they have a campus, etc. Or maybe they have multiple buildings. So then they can be elevated to "place status" and therefore you use at.
I work in a kindergarten.
You're saying there's a room or building labeled "kindergarten" and that's where you work. If it's part of a school or greater institution, this is proper to say.
I work at a kindergarten.
You're saying there's a place called a kindergarten and you work there. This gives the impression it's a separate building, with it's own parking lot, etc.