Why a stick when you can code an app for the TV ? Latency?
Would there be any benefits of using an stick over an app in a smart TV?
There's lots of reasons for a stick over an above an app. Some of those reasons are:
1. Not everyone has a smart TV but virtually everyone (in Microsoft's target audience, at least) has a TV with a HDMI port.
2. Some smart TVs have weird platforms and most of them have proprietary app stores. Getting an app onto any one individual store is usually not a problem but there's lots of them.
3. Smart TVs can fall out of update cycles, so even people who have a smart TV might find themselves losing access to apps/services over the long term.
4. Smart TV controller support (and Bluetooth stack optimisation) is...I'm not even sure. Quite possibly highly variable. Microsoft could mitigate this issue with a controller that connected to a wireless network, but they don't currently have one of those, while there are hundreds of millions of existing branded Xbox controllers out there that people might reasonably expect to work on an Xbox service. A stick could offer a guaranteed level of controller support via its own hardware.
5. A stick could also be used on monitors and not just TVs. Additionally a stick is useful in situations where someone has access to a TV's HDMI port but only limited access to the TV's OS (like hotel TVs).
6. A stick can save things like sign-in settings and controller pairings and maybe a few basic application-level settings and make them easier to transfer between displays (like moving between rooms or when visiting other people), without having to download the app again, mess about with controller pairings, sign in again, etc.
7. A stick gives Microsoft potential retail presence - it's something that can sit on shelves and appear in retail search results. That makes it more visible than an app. It'd also make it more giftable - if it were packed up with a 6-month subscription or similar, it'd make a good present for a lot of people.