Whats wrong with my query?
You need to use dynamic SQL for this. The following example will work (as does a quick check to see that the database exists, you could add additional checks as well).

DECLARE @DateString AS VARCHAR(256) ,
    @ExecuteText NVARCHAR(4000);
SET @DateString = CAST(YEAR(GETDATE()) AS VARCHAR(4)) + RIGHT('0'
                                                              + CAST(MONTH(GETDATE()) AS VARCHAR(2)),
                                                              2) + RIGHT('0'
                                                              + CAST(DAY(GETDATE()) AS VARCHAR(2)),
                                                              2);
DECLARE @DB AS VARCHAR(40);
SET @DB = 'DB01_' + @DateString;


IF EXISTS ( SELECT  name
            FROM    sys.databases
            WHERE   name = @DB )
    BEGIN
        SET @ExecuteText = N'ALTER AVAILABILITY GROUP AG1 ADD DATABASE ' + @DB
            + ';';
        EXEC sys.sp_executesql @ExecuteText;
    END;
ELSE
    BEGIN
        RAISERROR(N'Database: %s does not exist', 16, 1, @DB);
    END;
GO