5G communication technologies and networks help researchers and engineers look into intelligent transportation systems (ITS) with a new eye, including vehicular ad hoc networks (VANET) application. Network function virtualization (NFV) and network slicing (NS) are accepted as two most promising technologies towards the agile and elastic network architecture of 5G and beyond 5G (B5G). However, previous researchers studied NFV and NS separately. In addition, learning technologies, such as reinforcement leaning (RL), graph-based learning, emerge so as to enhance the network intelligence and resource allocation in recent years. Inspired from these, we jointly explore intelligent resource allocation issue within B5G-enabled VANETs. At first, the novel virtual resource allocation framework supporting NFV and NS for providing quality of service (QoS)-guaranteed slices is constructed. Then, we formulate the virtual resource allocation of slices as the optimization problem, having the goals of providing guaranteed QoS performance and maximizing the net profit. Considering the non convex attributes of the formulated optimization problem, we propose one intelligent and feasible algorithm instead, including the details of the proposed intelligent algorithm. We record the results in order to validate the feasibility and highlights of our proposed algorithm. For example, our intelligent algorithm has the slice acceptance advantage of 5%, comparing with the best existing work.