In your first couple of seasons of triathlon, before you're sure whether you plan to stay in the sport long term or not, we recommend a road bike. Road bikes are more versatile so you can ride with groups AND do triathlons.
Triathlon bikes, also known as time trial bikes, are not safe for group riding as they don't handle well on turns or uneven terrain. They are meant for one purpose only, which is racing in a triathlon.
You may want to purchase a pair of clip-on aerobars for your road bike so you can be more aero in a race. But, make sure to train in the aero position well in advance of your race so your body can get used to the very unnatural position. It often takes a few months of practice to get fully comfortable. Start with just 1-2 minutes at a time and work your way up gradually.
Once you know you’re going to stay in triathlon for a long period of time, a tri bike is most certainly a good purchase. $3k-$5k is a really good sweet spot to invest in a tri bike that has Ultegra or better components, and some race wheels. If you can do that (even if it’s used), you’ll have a bike that will hold its value for you really well.